未验证 提交 4aa20fd8 编写于 作者: A Asher

Fix require.toUrl on the Node side

- Fixes #542
上级 0cd4e460
......@@ -24,11 +24,14 @@ module.exports = (options = {}) => ({
test: /\.(j|t)s/,
options: {
multiple: [{
// These will be handled by file-loader. We need the location because
// they are parsed as URIs and will throw errors if not fully formed.
// The !! prefix causes it to ignore other loaders (doesn't work).
// These will be handled by file-loader. Must be a fully formed URI.
// The !! prefix causes it to ignore other loaders.
search: "require\\.toUrl\\(",
replace: "location.protocol + '//' + location.host + location.pathname.replace(/\\/$/,'') + '/' + require('!!file-loader?name=[path][name].[ext]!' + ",
replace: `${
options.node
? "'file://'"
: "location.protocol + '//' + location.host + location.pathname.replace(/\\/$/,'')"
} + '/' + require('!!file-loader?name=[path][name].[ext]!' + `,
flags: "g",
}, {
search: "require\\.__\\$__nodeRequire",
......
const merge = require("webpack-merge");
module.exports = (options = {}) => merge(
require("./webpack.general.config")(options), {
require("./webpack.general.config")({
...options,
node: true,
}), {
devtool: "none",
mode: "production",
target: "node",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册