Registry / devops / easywebpack-vue

easywebpack-vue

JSON →
library5.1.1jsnpmunverified

Vue-specific webpack build solution from the easywebpack ecosystem. Version 5.1.1 (stable) targets Webpack 5 and Babel 7. Provides preconfigured webpack configurations for Vue client render and server-side render builds, with easy integration into egg.js projects. Key differentiators: opinionated defaults optimized for Vue SFCs, support for both client and SSR, and integration with easywebpack-cli for project scaffolding. Release is ongoing with minor updates.

npm install easywebpack-vue
INSTALL
IMPORT
SIG · EASYWEBPACK-VUE
E
easywebpack-vue
devopsjavascriptv5.1.1
harness data pending
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'));"
Debug
Known issues
breakingVersion 5.x requires Webpack 5 and Babel 7. Do not mix with earlier webpack/babel versions.
fix
Upgrade to Webpack 5 and Babel 7. For older projects, use easywebpack-vue ^4.x.x for webpack 4 + Babel 7 or ^3.x.x for webpack 3.
affects: >=5.0.0
deprecatedVersion ^4.x.x (npm: easywebpack-vue) uses Webpack 4 and Babel 6; version 4.x.x is now deprecated.
fix
Update to easywebpack-vue ^5.1.1 or use @easy-team/easywebpack-vue ^4.x.x for Webpack 4 with Babel 7.
affects: >=4.0.0 <5.0.0
gotchaThe package is CJS-only; attempts to import with ESM import syntax will fail.
fix
Use require() or configure your bundler to handle CJS.
affects: >=5.0.0
gotchaThe entry option in getWebpackConfig expects an object with key 'app' or similar; single string entry may not work as expected.
fix
Always provide entry as an object: { app: 'src/index.js' }.
affects: >=5.0.0
gotchaThe package re-exports its own webpack instance; using require('webpack') separately may cause version mismatch errors.
fix
Always use the webpack property from the package (easywebpack.webpack) instead of requiring webpack directly.
affects: >=5.0.0
Errors
Common errors & fixes
Error: Cannot find module 'easywebpack'
easywebpack-vue has a peer dependency on easywebpack which must be installed explicitly.
fix
Run 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.
fix
Run 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().
fix
Use 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.
fix
Check getWebpackConfig options: env must be one of 'dev', 'test', 'prod', or an object. Refer to docs.
Upgrade
Version history
5.1.1latest on npm
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).
Agent activity
2 hits · last 30 days
node
2
Resources