我尝试添加此扩展名:
https://www.npmjs.com/package/webpack-require-http
到webpack再加一次:
.addExternals({
'webpack-require-http' :require('webpack-require-http')
})
但是我得到了:
encore dev --watch
Running webpack ...
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration.externals should be one of these:
string | object { <key>: string | object | boolean } | function | RegExp | [string | object { <key>: string | object | boolean } | function | RegExp | [(recursive)]]
-> Specify dependencies that shouldn't be resolved by webpack, but should become dependencies of the resulting bundle. The kind of the dependency depends on `output.libraryTarget`.
Details:
* configuration.externals should be a string.
-> An exact matched dependency becomes external. The same string is used as external dependency.
* configuration.externals['webpack-require-http'] should be a string.
* configuration.externals['webpack-require-http'] should be an object.
* configuration.externals['webpack-require-http'] should be a boolean.
* configuration.externals should be an instance of function
-> `function(context, request, callback(err, result))` The function is called on each dependency.
* configuration.externals should be an instance of RegExp
-> Every matched dependency becomes external.
* configuration.externals should be an array:
[string | object { <key>: string | object | boolean } | function | RegExp | [(recursive)]]
error Command failed with exit code 1.
我想将php生成的js加载到webpack。
在vendor.js中添加:
require('http://10.2.0.2/vars.js');
此网址文件是php生成的js。