webpack-core

raw JSON →
0.6.9 verified Sat Apr 25 auth: no javascript deprecated

The shared core of webpack and enhanced-require, encapsulating loader mechanics and SourceMap handling. Version 0.6.9 is the latest (no longer maintained; last release 2014). It is not intended as a standalone module but provides infrastructure for custom loaders and plugins. Webpack 1.x used this; later versions replaced it with webpack-sources and internal refactoring. Key differentiator: it was the foundational runtime for webpack's loader pipeline before being absorbed into webpack proper. Requires Node >=0.6.

error Cannot find module 'webpack-core'
cause Package not installed; webpack-core is internal and not published separately.
fix
Install webpack (includes webpack-core internally).
error Module not found: Error: Cannot resolve module 'webpack-core/lib/SourceMapSource'
cause Incorrect import path.
fix
Use: const SourceMapSource = require('webpack-core').SourceMapSource;
deprecated webpack-core is no longer maintained. Use webpack >= 2.0 which includes its own core.
fix Upgrade to webpack 2 or later.
gotcha Not a standalone module; requires webpack context.
fix Do not import directly; use webpack's public API.
npm install webpack-core
yarn add webpack-core
pnpm add webpack-core

Shows basic webpack usage (webpack-core is not used standalone).

const webpack = require('webpack');
const config = {
  entry: './src/index.js',
  output: { path: './dist', filename: 'bundle.js' },
  module: { loaders: [{ test: /\.js$/, loader: 'babel' }] },
  plugins: []
};
webpack(config, (err, stats) => {
  if (err) console.error(err);
  else console.log(stats.toString());
});