ue,与webpack 4捆绑在一起时无法解析依赖项

时间:2018-06-20 22:24:19

标签: webpack kue

使用webpack编译时遇到麻烦。以下是webpack配置:

const path = require('path');

module.exports = {
    mode: 'development',
    entry: ['./src/app.js'],
    output: {
        path: path.resolve(__dirname, 'dist'),
        filename: 'driver.js'
    },
    module: {
        rules: [
            {
                test: /\.jsx?$/,
                loader: 'babel-loader',
                options: {
                    presets: ['env']
                }
            },
            {
                test: /\.node$/,
                loader: 'node-loader'
            }
        ]
    },
    resolve: {
        modules: [
            path.resolve(__dirname, 'node_modules')
        ],
        extensions: ['.js', '.jsx']
    },
    devtool: 'source-map',
    context: __dirname,
    target: 'node',
    externals: []
};

以下是webpack的输出:

[BABEL] Note: The code generator has deoptimised the styling of "./node_modules/lodash/lodash.js" as it exceeds the max of "500KB".
Hash: 50ba02433ba0abe6ce2f
Version: webpack 4.12.0
Time: 25265ms
Built at: 06/20/2018 6:07:48 PM
        Asset      Size  Chunks             Chunk Names
    driver.js  4.08 MiB    main  [emitted]  main
driver.js.map  6.29 MiB    main  [emitted]  main
[./src/Adapters/Inbound/TwilioSMS/index.js] 2.76 KiB {main} [built]
[./src/Adapters/Outbound/OutboundAdapter.js] 1.74 KiB {main} [built]
[./src/Adapters/Outbound/index.js] 784 bytes {main} [built]
[./src/Adapters/index.js] 381 bytes {main} [built]
[./src/Enqueuer/index.js] 1.44 KiB {main} [built]
[./src/Resolver/index.js] 1.48 KiB {main} [built]
[0] multi ./src/app.js 28 bytes {main} [built]
[./src/app.js] 1.98 KiB {main} [built]
[events] external "events" 42 bytes {main} [built]
[net] external "net" 42 bytes {main} [built]
[os] external "os" 42 bytes {main} [built]
[path] external "path" 42 bytes {main} [built]
[querystring] external "querystring" 42 bytes {main} [built]
[util] external "util" 42 bytes {main} [built]
[zlib] external "zlib" 42 bytes {main} [built]
    + 841 hidden modules

WARNING in ./node_modules/source-map/lib/source-map/source-node.js 10:43-50
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
 @ ./node_modules/source-map/lib/source-map.js
 @ ./node_modules/stylus/lib/visitor/sourcemapper.js
 @ ./node_modules/stylus/lib/renderer.js
 @ ./node_modules/stylus/lib/stylus.js
 @ ./node_modules/stylus/index.js
 @ ./node_modules/kue/lib/http/index.js
 @ ./node_modules/kue/lib/kue.js
 @ ./node_modules/kue/index.js
 @ ./src/app.js
 @ multi ./src/app.js

WARNING in ./node_modules/source-map/lib/source-map/source-map-generator.js 10:43-50
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
 @ ./node_modules/source-map/lib/source-map.js
 @ ./node_modules/stylus/lib/visitor/sourcemapper.js
 @ ./node_modules/stylus/lib/renderer.js
 @ ./node_modules/stylus/lib/stylus.js
 @ ./node_modules/stylus/index.js
 @ ./node_modules/kue/lib/http/index.js
 @ ./node_modules/kue/lib/kue.js
 @ ./node_modules/kue/index.js
 @ ./src/app.js
 @ multi ./src/app.js

WARNING in ./node_modules/source-map/lib/source-map/source-map-consumer.js 10:43-50
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
 @ ./node_modules/source-map/lib/source-map.js
 @ ./node_modules/stylus/lib/visitor/sourcemapper.js
 @ ./node_modules/stylus/lib/renderer.js
 @ ./node_modules/stylus/lib/stylus.js
 @ ./node_modules/stylus/index.js
 @ ./node_modules/kue/lib/http/index.js
 @ ./node_modules/kue/lib/kue.js
 @ ./node_modules/kue/index.js
 @ ./src/app.js
 @ multi ./src/app.js

WARNING in ./node_modules/pug-filters/lib/run-filter.js 14:11-105
Critical dependency: the request of a dependency is an expression
 @ ./node_modules/pug-filters/index.js
 @ ./node_modules/pug/lib/index.js
 @ ./node_modules/kue/lib/http/index.js
 @ ./node_modules/kue/lib/kue.js
 @ ./node_modules/kue/index.js
 @ ./src/app.js
 @ multi ./src/app.js

WARNING in ./node_modules/nib/lib/nib.js 36:18-66
Critical dependency: the request of a dependency is an expression
 @ ./node_modules/kue/lib/http/index.js
 @ ./node_modules/kue/lib/kue.js
 @ ./node_modules/kue/index.js
 @ ./src/app.js
 @ multi ./src/app.js

WARNING in ./node_modules/stylus/lib/utils.js 136:15-48
Critical dependency: the request of a dependency is an expression
 @ ./node_modules/stylus/lib/stylus.js
 @ ./node_modules/stylus/index.js
 @ ./node_modules/kue/lib/http/index.js
 @ ./node_modules/kue/lib/kue.js
 @ ./node_modules/kue/index.js
 @ ./src/app.js
 @ multi ./src/app.js

WARNING in ./node_modules/stylus/lib/functions/use.js 31:11-39
Critical dependency: the request of a dependency is an expression
 @ ./node_modules/stylus/lib/functions/index.js
 @ ./node_modules/stylus/lib/stylus.js
 @ ./node_modules/stylus/index.js
 @ ./node_modules/kue/lib/http/index.js
 @ ./node_modules/kue/lib/kue.js
 @ ./node_modules/kue/index.js
 @ ./src/app.js
 @ multi ./src/app.js

WARNING in ./node_modules/uglify-js/tools/node.js 13:11-32
Critical dependency: the request of a dependency is an expression
 @ ./node_modules/pug-filters/lib/run-filter.js
 @ ./node_modules/pug-filters/index.js
 @ ./node_modules/pug/lib/index.js
 @ ./node_modules/kue/lib/http/index.js
 @ ./node_modules/kue/lib/kue.js
 @ ./node_modules/kue/index.js
 @ ./src/app.js
 @ multi ./src/app.js

WARNING in ./node_modules/bindings/bindings.js 82:43-53
Critical dependency: the request of a dependency is an expression
 @ ./node_modules/hiredis/hiredis.js
 @ ./node_modules/redis-parser/lib/hiredis.js
 @ ./node_modules/redis-parser/lib/parser.js
 @ ./node_modules/redis-parser/index.js
 @ ./node_modules/redis/index.js
 @ ./node_modules/kue/lib/redis.js
 @ ./node_modules/kue/lib/kue.js
 @ ./node_modules/kue/index.js
 @ ./src/app.js
 @ multi ./src/app.js

WARNING in ./node_modules/bindings/bindings.js 82:22-40
Critical dependency: the request of a dependency is an expression
 @ ./node_modules/hiredis/hiredis.js
 @ ./node_modules/redis-parser/lib/hiredis.js
 @ ./node_modules/redis-parser/lib/parser.js
 @ ./node_modules/redis-parser/index.js
 @ ./node_modules/redis/index.js
 @ ./node_modules/kue/lib/redis.js
 @ ./node_modules/kue/lib/kue.js
 @ ./node_modules/kue/index.js
 @ ./src/app.js
 @ multi ./src/app.js

WARNING in ./node_modules/express/lib/view.js 79:13-25
Critical dependency: the request of a dependency is an expression
 @ ./node_modules/express/lib/application.js
 @ ./node_modules/express/lib/express.js
 @ ./node_modules/express/index.js
 @ ./src/app.js
 @ multi ./src/app.js

WARNING in ./node_modules/natural/lib/natural/wordnet/wordnet.js
Module not found: Error: Can't resolve 'WNdb' in './node_modules/natural/lib/natural/wordnet'
 @ ./node_modules/natural/lib/natural/wordnet/wordnet.js
 @ ./node_modules/natural/lib/natural/index.js
 @ ./node_modules/reds/lib/reds.js
 @ ./node_modules/reds/index.js
 @ ./node_modules/kue/lib/queue/job.js
 @ ./node_modules/kue/lib/kue.js
 @ ./node_modules/kue/index.js
 @ ./src/app.js
 @ multi ./src/app.js

WARNING in ./node_modules/nib/lib/nib.js
Module not found: Error: Can't resolve 'canvas' in './node_modules/nib/lib'
 @ ./node_modules/nib/lib/nib.js
 @ ./node_modules/kue/lib/http/index.js
 @ ./node_modules/kue/lib/kue.js
 @ ./node_modules/kue/index.js
 @ ./src/app.js
 @ multi ./src/app.js

WARNING in ./node_modules/sylvester/lib/node-sylvester/matrix.js
Module not found: Error: Can't resolve 'lapack' in './node_modules/sylvester/lib/node-sylvester'
 @ ./node_modules/sylvester/lib/node-sylvester/matrix.js
 @ ./node_modules/sylvester/lib/node-sylvester/index.js
 @ ./node_modules/apparatus/lib/apparatus/clusterer/kmeans.js
 @ ./node_modules/apparatus/lib/apparatus/index.js
 @ ./node_modules/natural/lib/natural/classifiers/bayes_classifier.js
 @ ./node_modules/natural/lib/natural/index.js
 @ ./node_modules/reds/lib/reds.js
 @ ./node_modules/reds/index.js
 @ ./node_modules/kue/lib/queue/job.js
 @ ./node_modules/kue/lib/kue.js
 @ ./node_modules/kue/index.js
 @ ./src/app.js
 @ multi ./src/app.js

ERROR in ./node_modules/stylus/lib/stylus.js
Module not found: Error: Can't resolve '../package' in './node_modules/stylus/lib'
 @ ./node_modules/stylus/lib/stylus.js 27:18-39
 @ ./node_modules/stylus/index.js
 @ ./node_modules/kue/lib/http/index.js
 @ ./node_modules/kue/lib/kue.js
 @ ./node_modules/kue/index.js
 @ ./src/app.js
 @ multi ./src/app.js

ERROR in ./node_modules/stylus/index.js
Module not found: Error: Can't resolve './lib-cov/stylus' in './node_modules/stylus'
 @ ./node_modules/stylus/index.js 3:42-69
 @ ./node_modules/kue/lib/http/index.js
 @ ./node_modules/kue/lib/kue.js
 @ ./node_modules/kue/index.js
 @ ./src/app.js
 @ multi ./src/app.js

ERROR in ./node_modules/nib/lib/nodes/gradient.js
Module not found: Error: Can't resolve 'canvas' in './node_modules/nib/lib/nodes'
 @ ./node_modules/nib/lib/nodes/gradient.js 8:13-30
 @ ./node_modules/nib/lib/nib.js
 @ ./node_modules/kue/lib/http/index.js
 @ ./node_modules/kue/lib/kue.js
 @ ./node_modules/kue/index.js
 @ ./src/app.js
 @ multi ./src/app.js

ERROR in ./node_modules/nib/lib/nodes/color-image.js
Module not found: Error: Can't resolve 'canvas' in './node_modules/nib/lib/nodes'
 @ ./node_modules/nib/lib/nodes/color-image.js 8:13-30
 @ ./node_modules/nib/lib/nib.js
 @ ./node_modules/kue/lib/http/index.js
 @ ./node_modules/kue/lib/kue.js
 @ ./node_modules/kue/index.js
 @ ./src/app.js
 @ multi ./src/app.js

npm ERR! Darwin 17.6.0
npm ERR! argv "./.nvm/versions/node/v7.7.3/bin/node" "./.nvm/versions/node/v7.7.3/bin/npm" "run" "build"
npm ERR! node v7.7.3
npm ERR! npm  v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! myapp@1.0.0 build: `webpack --config webpack.config.js`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the myapp@1.0.0 build script 'webpack --config webpack.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the myapp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     webpack --config webpack.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs myapp
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls myapp
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     ./npm-debug.log

知道为什么会发生吗?添加kue库时会引入大多数这些错误/警告。

如果需要任何其他信息来帮助您,请告诉我。 感谢您的帮助!

0 个答案:

没有答案