webpack-dev-server 2.4.2中有哪些更改导致“丢失文件”错误?

时间:2017-03-31 16:50:20

标签: angular webpack webpack-dev-server

我们应该如何运行webpack-dev-server?搬到后:

"webpack": "^2.1.0-beta.25",
"webpack-dev-server": "^2.1.0-beta.5",

TO:

"webpack": "^2.3.2",
"webpack-dev-server": "^2.4.2"

我的package.json有这个脚本:

"build:dev-server": "webpack-dev-server --progress --port 8080 --hot --host 0.0.0.0 --config config/webpack.dev.config.js",

使用--config我从webpack-dev-server

获得以下输出
10% building modules 5/11 modules 6 active ...e/node_modules/webpack/hot/emitter.jsUsage: /Users/jared.youtsey/src/Quartz/Portal/source/node_modules/.bin/webpack-dev-server [options] file ...

Options:
  -c, --config          configuration file                                                                                
  -e, --exclude         exclude globs from path expansion                                                                 
...                                                                                  

Missing files

如果我删除了--config,我会得到大量缺失的解决方案,例如:

WARNING in ./~/fsevents/~/node-pre-gyp/lib/util/compile.js
Module not found: Error: Can't resolve 'npm' in '/Users/jared.youtsey/src/Quartz/Portal/source/node_modules/fsevents/node_modules/node-pre-gyp/lib/util'
...

WARNING in ./~/html-webpack-plugin/index.js
227:81-88 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

WARNING in ./~/ajv/lib/async.js
96:20-33 Critical dependency: the request of a dependency is an expression

WARNING in ./~/ajv/lib/async.js
119:15-28 Critical dependency: the request of a dependency is an expression

WARNING in ./~/ajv/lib/compile/index.js
13:21-34 Critical dependency: the request of a dependency is an expression

WARNING in ./~/loader-runner/lib/loadLoader.js
3:2-28 Critical dependency: the request of a dependency is an expression

WARNING in ./~/fsevents/fsevents.js
14:13-71 Critical dependency: the request of a dependency is an expression

WARNING in ./~/fsevents/~/node-pre-gyp/lib/pre-binding.js
19:22-48 Critical dependency: the request of a dependency is an expression

WARNING in ./~/fsevents/~/node-pre-gyp/lib/util/versioning.js
15:20-67 Critical dependency: the request of a dependency is an expression

ERROR in ./~/html-webpack-plugin/index.js
Module not found: Error: Can't resolve 'fs' in '/Users/jared.youtsey/src/Quartz/Portal/source/node_modules/html-webpack-plugin'
@ ./~/html-webpack-plugin/index.js 3:9-22
@ ./config/webpack.dev.config.js
@ multi (webpack)-dev-server/client?http://0.0.0.0:8080 webpack/hot/dev-server ./config/webpack.dev.config.js

...

ERROR in ./~/fsevents/~/node-pre-gyp/lib/clean.js
Module not found: Error: Can't resolve 'fs' in '/Users/jared.youtsey/src/Quartz/Portal/source/node_modules/fsevents/node_modules/node-pre-gyp/lib'
@ ./~/fsevents/~/node-pre-gyp/lib/clean.js 7:9-22 9:13-26
@ ./~/fsevents/~/node-pre-gyp/lib ^\.\/.*$
@ ./~/fsevents/~/node-pre-gyp/lib/node-pre-gyp.js
@ ./~/fsevents/fsevents.js
@ ./~/chokidar/lib/fsevents-handler.js
@ ./~/chokidar/index.js
@ ./~/watchpack/lib/DirectoryWatcher.js
@ ./~/watchpack/lib/watcherManager.js
@ ./~/watchpack/lib/watchpack.js
@ (webpack)/lib/node/NodeWatchFileSystem.js
@ (webpack)/lib ^.*$
@ (webpack)/lib/webpack.js
@ ./config/webpack.dev.config.js
@ multi (webpack)-dev-server/client?http://0.0.0.0:8080 webpack/hot/dev-server ./config/webpack.dev.config.js

...

ERROR in ./~/request/~/tunnel-agent/index.js
Module not found: Error: Can't resolve 'tls' in '/Users/jared.youtsey/src/Quartz/Portal/source/node_modules/request/node_modules/tunnel-agent'
@ ./~/request/~/tunnel-agent/index.js 4:10-24
@ ./~/request/lib/tunnel.js
@ ./~/request/request.js
@ ./~/request/index.js
@ ./~/node-gyp/lib/install.js
@ ./~/node-gyp/lib ^\.\/.*$
@ ./~/node-gyp/lib/node-gyp.js
@ ./~/fsevents/~/node-pre-gyp/lib/util/compile.js
@ ./~/fsevents/~/node-pre-gyp/lib ^\.\/.*$
@ ./~/fsevents/~/node-pre-gyp/lib/node-pre-gyp.js
@ ./~/fsevents/fsevents.js
@ ./~/chokidar/lib/fsevents-handler.js
@ ./~/chokidar/index.js
@ ./~/watchpack/lib/DirectoryWatcher.js
@ ./~/watchpack/lib/watcherManager.js
@ ./~/watchpack/lib/watchpack.js
@ (webpack)/lib/node/NodeWatchFileSystem.js
@ (webpack)/lib ^.*$
@ (webpack)/lib/webpack.js
@ ./config/webpack.dev.config.js
@ multi (webpack)-dev-server/client?http://0.0.0.0:8080 webpack/hot/dev-server ./config/webpack.dev.config.js
webpack: Failed to compile.

我在webpack.dev.config.json

中添加了以下内容(据说可以解决丢失的分辨率,但没有)
    node: {
        console: false,
        global: true,
        process: true,
        Buffer: true,
        __filename: "mock",
        __dirname: "mock",
        setImmediate: true,
        fs: "empty",
        net: "empty",
        tls: "empty"
    },

0 个答案:

没有答案