0
Windows Dev 시스템에서 webpack 및 node.js를 테스트하고 있습니다. I가이 스크립트 'webpack.config.js' Webpack 최적화 생성자를 찾을 수 없습니다.
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
context: __dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: "./js/scripts.js",
output: {
path: __dirname + "/js",
filename: "scripts.min.js"
},
plugins: debug ? [] : [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({ mangle: false, sourcemap: false }),
],
};
나는 다음과 같은 오류가 나타날 생산 태그 웹팩 전화
:C:\Users\srussell\Desktop\GitHub\nodejsTest\webpack.config.js:14
new webpack.optimize.OccurenceOrderPlugin(),
^
TypeError: webpack.optimize.OccurenceOrderPlugin is not a constructor
at Object.<anonymous> (C:\Users\srussell\Desktop\GitHub\nodejsTest\webpack.config.js:14:5)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at requireConfig (C:\Users\srussell\AppData\Roaming\npm\node_modules\webpack\bin\convert-argv.js:96:18)
at C:\Users\srussell\AppData\Roaming\npm\node_modules\webpack\bin\convert-argv.js:109:17
그러나 내가 노드의 콘솔에서 console.log(require('webpack'));
을 실행할 때 cmd는 내가 webpack을 설치하고 최적화 함수와 메소드를 사용할 수 있음을 보여줍니다.
C:\Users\srussell\Desktop\GitHub\nodejsTest>node
> console.log(require('webpack'));
{ [Function: webpack]
WebpackOptionsDefaulter: [Function: WebpackOptionsDefaulter],
WebpackOptionsApply: [Function: WebpackOptionsApply],
Compiler: { [Function: Compiler] Watching: [Function: Watching] },
MultiCompiler: [Function: MultiCompiler],
NodeEnvironmentPlugin: [Function: NodeEnvironmentPlugin],
validate: [Function: bound validateSchema],
validateSchema: [Function: validateSchema],
WebpackOptionsValidationError: [Function: WebpackOptionsValidationError],
DefinePlugin: [Getter],
NormalModuleReplacementPlugin: [Getter],
ContextReplacementPlugin: [Getter],
IgnorePlugin: [Getter],
WatchIgnorePlugin: [Getter],
BannerPlugin: [Getter],
PrefetchPlugin: [Getter],
AutomaticPrefetchPlugin: [Getter],
ProvidePlugin: [Getter],
HotModuleReplacementPlugin: [Getter],
SourceMapDevToolPlugin: [Getter],
EvalSourceMapDevToolPlugin: [Getter],
EvalDevToolModulePlugin: [Getter],
CachePlugin: [Getter],
ExtendedAPIPlugin: [Getter],
ExternalsPlugin: [Getter],
JsonpTemplatePlugin: [Getter],
LibraryTemplatePlugin: [Getter],
LoaderTargetPlugin: [Getter],
MemoryOutputFileSystem: [Getter],
ProgressPlugin: [Getter],
SetVarMainTemplatePlugin: [Getter],
UmdMainTemplatePlugin: [Getter],
NoErrorsPlugin: [Getter],
NoEmitOnErrorsPlugin: [Getter],
NewWatchingPlugin: [Getter],
EnvironmentPlugin: [Getter],
DllPlugin: [Getter],
DllReferencePlugin: [Getter],
LoaderOptionsPlugin: [Getter],
NamedModulesPlugin: [Getter],
HashedModuleIdsPlugin: [Getter],
ModuleFilenameHelpers: [Getter],
optimize:
{ AggressiveMergingPlugin: [Getter],
AggressiveSplittingPlugin: [Getter],
CommonsChunkPlugin: [Getter],
ChunkModuleIdRangePlugin: [Getter],
DedupePlugin: [Getter],
LimitChunkCountPlugin: [Getter],
MinChunkSizePlugin: [Getter],
OccurrenceOrderPlugin: [Getter],
UglifyJsPlugin: [Getter] },
dependencies: {} }
undefined
도움을 주시면 감사하겠습니다. 도움이된다면 프로젝트 링크가 있습니다. https://github.com/russellsean/nodejsTest