TypeError: SuppressChunksPlugin is not a constructor, how to overcome this is a webpack?
TypeError: SuppressChunksPlugin is not a constructor, how to overcome this is a webpack?
new SuppressChunksPlugin([
^
TypeError: SuppressChunksPlugin 不是构造函数
在对象。 (/Users/rohit/WebstormProjects/myProjectStructure/webpack.config.js:80:9)
在 Module._compile (module.js:570:32)
在 Object.Module._extensions..js (module.js:579:10)
在 Module.load (module.js:487:32)
在 tryModuleLoad (module.js:446:12)
在 Function.Module._load (module.js:438:3)
在 Module.require (module.js:497:17)
在要求 (internal/module.js:20:19)
在 requireConfig (/usr/local/lib/node_modules/webpack/bin/convert-argv.js:97:18)
在 /usr/local/lib/node_modules/webpack/bin/convert-argv.js:104:17
以下是网络配置文件。
var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var SuppressChunksPlugin = require('suppress-chunks-webpack-plugin');
module.exports = {
context: path.resolve(__dirname, './src'),
entry: {
blitz: './blitz.js',
},
output: {
path: path.resolve(__dirname, './dist/assets'),
filename: '[name].bundle.js'
},
module: {
rules: [
{
test: /\.less$/,
use: ExtractTextPlugin.extract({
// use style-loader in development
fallback: 'style-loader',
use: 'css-loader?minimize!less-loader'
})
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use:'css-loader?minimize'
})
}
]
},
plugins:[
new ExtractTextPlugin('[name].css'),
new SuppressChunksPlugin([
{name: 'blitz', match: /\.js$/},
])
]
};
suppress-chunks-webpack-plugin
使用ES modules and only has a default export (see also the transpiled source unpkg - suppress-chunks-webpack-plugin).
要将它与 Node 的 require
一起使用,您需要访问 default
属性.
var SuppressChunksPlugin = require('suppress-chunks-webpack-plugin').default;
new SuppressChunksPlugin([
^
TypeError: SuppressChunksPlugin 不是构造函数 在对象。 (/Users/rohit/WebstormProjects/myProjectStructure/webpack.config.js:80:9) 在 Module._compile (module.js:570:32) 在 Object.Module._extensions..js (module.js:579:10) 在 Module.load (module.js:487:32) 在 tryModuleLoad (module.js:446:12) 在 Function.Module._load (module.js:438:3) 在 Module.require (module.js:497:17) 在要求 (internal/module.js:20:19) 在 requireConfig (/usr/local/lib/node_modules/webpack/bin/convert-argv.js:97:18) 在 /usr/local/lib/node_modules/webpack/bin/convert-argv.js:104:17
以下是网络配置文件。
var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var SuppressChunksPlugin = require('suppress-chunks-webpack-plugin');
module.exports = {
context: path.resolve(__dirname, './src'),
entry: {
blitz: './blitz.js',
},
output: {
path: path.resolve(__dirname, './dist/assets'),
filename: '[name].bundle.js'
},
module: {
rules: [
{
test: /\.less$/,
use: ExtractTextPlugin.extract({
// use style-loader in development
fallback: 'style-loader',
use: 'css-loader?minimize!less-loader'
})
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use:'css-loader?minimize'
})
}
]
},
plugins:[
new ExtractTextPlugin('[name].css'),
new SuppressChunksPlugin([
{name: 'blitz', match: /\.js$/},
])
]
};
suppress-chunks-webpack-plugin
使用ES modules and only has a default export (see also the transpiled source unpkg - suppress-chunks-webpack-plugin).
要将它与 Node 的 require
一起使用,您需要访问 default
属性.
var SuppressChunksPlugin = require('suppress-chunks-webpack-plugin').default;