Constellate Webpack Compiler Plugin
raw JSON → 0.14.0 verified Fri May 01 auth: no javascript
A Webpack-based compiler plugin for Constellate bundling toolchain. Version 0.14.0 integrates with Constellate's pipeline to handle Webpack compilation and code splitting. Maintained as part of the Constellate monorepo with sporadic releases. Differentiates from other Webpack wrappers by being tightly coupled to Constellate's declarative configuration and plugin system.
Common errors
error Error: Cannot find module 'constellate-plugin-compiler-webpack' ↓
cause Package not installed or incorrect import path.
fix
Run
npm install constellate-plugin-compiler-webpack and ensure correct import. error TypeError: WebpackCompilerPlugin is not a constructor ↓
cause Using default import without named import or incorrect bundler configuration.
fix
Use
import { WebpackCompilerPlugin } from 'constellate-plugin-compiler-webpack'. error Configuration error: 'webpackConfig' is required ↓
cause Missing webpackConfig in constructor options (breaking change in 0.14.0).
fix
Add a
webpackConfig object to the plugin constructor. Warnings
breaking Version 0.14.0 changes the plugin constructor signature; `webpackConfig` is now required instead of optional. ↓
fix Provide a `webpackConfig` object to the constructor.
deprecated The `enableHMR` option is deprecated in favor of setting `webpackConfig.devServer.hot`. ↓
fix Use `webpackConfig.devServer.hot: true` instead.
gotcha Plugin requires Webpack 5; using Webpack 4 will cause silent failures. ↓
fix Ensure Webpack 5 is installed as a peer dependency.
Install
npm install constellate-plugin-compiler-webpack yarn add constellate-plugin-compiler-webpack pnpm add constellate-plugin-compiler-webpack Imports
- WebpackCompilerPlugin wrong
const WebpackCompilerPlugin = require('constellate-plugin-compiler-webpack')correctimport { WebpackCompilerPlugin } from 'constellate-plugin-compiler-webpack' - WebpackCompilerPlugin
const { WebpackCompilerPlugin } = require('constellate-plugin-compiler-webpack') - default wrong
import { default } from 'constellate-plugin-compiler-webpack'correctimport WebpackCompilerPlugin from 'constellate-plugin-compiler-webpack'
Quickstart
import { WebpackCompilerPlugin } from 'constellate-plugin-compiler-webpack';
import { Project } from 'constellate';
const project = new Project({
root: process.cwd(),
plugins: [
new WebpackCompilerPlugin({
webpackConfig: {
output: { filename: 'bundle.js' },
mode: 'production'
}
})
]
});
await project.compile();