Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
easywebpack
✓ const easywebpack = require('easywebpack-vue');
✗ import easywebpack from 'easywebpack-vue'
This package is CJS-only; ESM import will fail.
getWebpackConfig
✓ const { getWebpackConfig } = require('easywebpack-vue');
✗ const getWebpackConfig = require('easywebpack-vue').getWebpackConfig;
Both work, but destructuring is cleaner. getWebpackConfig is a named export.
webpack
✓ const { webpack } = require('easywebpack-vue');
✗ const webpack = require('webpack')
The package re-exports webpack with plugins and loaders pre-configured. Use the package's own webpack instance to avoid version mismatch.
merge
✓ const { merge } = require('easywebpack-vue');
✗ const merge = require('webpack-merge')
merge is re-exported from easywebpack-vue with optimized defaults. Avoid installing webpack-merge separately.
server
✓ easywebpack.server(config);
✗ require('easywebpack-vue').server(config)
server is a method called on the main export, not a named export.
build
✓ easywebpack.build(config);
✗ const { build } = require('easywebpack-vue')
build is a method on the main export, not a named export.
Shows how to create a webpack config using easywebpack-vue's getWebpackConfig and merge for Vue client-side rendering.
// webpack.config.js
const easywebpack = require('easywebpack-vue');
const { getWebpackConfig, webpack, merge } = easywebpack;
const env = process.env.NODE_ENV || 'dev'; // 'dev', 'test', 'prod'
const baseConfig = getWebpackConfig({
env,
target: 'web',
entry: {
app: './src/index.js'
}
});
// Add custom loaders if needed
const customConfig = {
module: {
rules: [
{
test: /\.svg$/,
use: 'svg-inline-loader'
}
]
},
plugins: [
new webpack.DefinePlugin({
'process.env.API_URL': JSON.stringify('https://api.example.com')
})
]
};
module.exports = merge(baseConfig, customConfig);
// Run build: node -e "const easywebpack = require('easywebpack-vue'); easywebpack.build(require('./webpack.config.js'));"
Errors
Common errors & fixes
Error: Cannot find module 'easywebpack'
easywebpack-vue has a peer dependency on easywebpack which must be installed explicitly.
fixRun npm install easywebpack --save-dev alongside easywebpack-vue.
Module not found: Error: Can't resolve 'webpack' in ...
Webpack is a peer dependency and not automatically installed.
fixRun npm install webpack@5 --save-dev (or the version matching easywebpack-vue).
TypeError: getWebpackConfig is not a function
Importing using ESM syntax (import) instead of require().
fixUse const { getWebpackConfig } = require('easywebpack-vue'); Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
Passing invalid options to getWebpackConfig, e.g., env as string instead of object.
fixCheck getWebpackConfig options: env must be one of 'dev', 'test', 'prod', or an object. Refer to docs.
Audit
Dependencies
easywebpackrequiredCore easywebpack functionality is required; easywebpack-vue extends it for Vue.
webpackoptionalWebpack is a peer dependency for build configuration (v5 for easywebpack-vue 5.x).