Constellate Webpack Node Compiler Plugin

raw JSON →
0.14.0 verified Fri May 01 auth: no javascript

A Webpack compiler plugin targeting Node.js for Constellate projects. Version 0.14.0, part of the Constellate ecosystem. It integrates Webpack with Node.js builds for Constellate, offering optimized bundling for server-side applications. Differentiates by being purpose-built for Constellate's workflow, using Webpack 5. No indication of release cadence; likely released alongside Constellate updates. Requires @constellates/constellate and webpack as peer dependencies.

error Cannot find module '@constellates/constellate'
cause Missing peer dependency @constellates/constellate.
fix
npm install @constellates/constellate --save-dev
error TypeError: ConstellatePluginCompilerWebpackNode is not a constructor
cause Using default import incorrectly with CommonJS require.
fix
Use named import: import { ConstellatePluginCompilerWebpackNode } from '...'
error Error: webpack configuration must be an object
cause Missing or malformed options passed to the plugin constructor.
fix
Pass a valid options object with entry, output, etc.
error Module not found: Error: Can't resolve 'webpack'
cause Missing webpack dependency.
fix
npm install webpack@5 --save-dev
breaking Version 0.14.0 dropped support for webpack 4. Upgrade to webpack 5.
fix Update webpack to version 5 in your project.
deprecated Default export is deprecated in favor of named export ConstellatePluginCompilerWebpackNode.
fix Switch to named import: import { ConstellatePluginCompilerWebpackNode } from '...'
gotcha Plugin requires @constellates/constellate to be installed globally or as a peer dependency.
fix Install @constellates/constellate as a dependency: npm install @constellates/constellate
gotcha When running in a Node environment, the output target must be set to 'node' for compatibility.
fix Set webpack config option target: 'node'
breaking Breaking change: the constructor options format changed in 0.13.0. The context property is required.
fix Ensure context is provided in the options object.
npm install constellate-plugin-compiler-webpack-node
yarn add constellate-plugin-compiler-webpack-node
pnpm add constellate-plugin-compiler-webpack-node

This shows how to create a webpack compiler instance for Node.js using Constellate plugin and run it.

import ConstellatePluginCompilerWebpackNode from 'constellate-plugin-compiler-webpack-node';
import webpack from 'webpack';

const compiler = new ConstellatePluginCompilerWebpackNode({
  context: process.cwd(),
  entry: './src/index.js',
  output: {
    path: './dist',
    filename: 'bundle.js'
  },
  target: 'node',
  mode: 'production'
});

compiler.run((err, stats) => {
  if (err) console.error(err);
  console.log(stats.toString({ colors: true }));
});