我正在使用next.config.js
文件来修改其Webpack设置。但是在我的终端中,我看到了:
owner@G700:~/PhpstormProjects/shopify/buyUsed$ next
[ wait ] starting the development server ...
[ info ] waiting on http://localhost:3000 ...
[ error ] chunk static/runtime/webpack.js [entry]
devSpecific/output.js
Conflict: Multiple chunks emit assets to the same filename devSpecific/output.js (chunks main and static/runtime/webpack.js)
[ wait ] compiling ...
[ error ] chunk static/runtime/webpack.js [entry]
devSpecific/output.js
Conflict: Multiple chunks emit assets to the same filename devSpecific/output.js (chunks main and static/runtime/webpack.js)
似乎某些库文件都在进行某种临时分块。
有关我的设置的更多详细信息:
output.js
。它与入口./devSpecific
在同一项目子文件夹index.tsx
中。./devSpecific
设置为开发服务器的内容库,以便有一个沙箱区域来开发一些React组件。 我的设置:
const { parsed: localEnv } = require("dotenv").config();
const withCSS = require("@zeit/next-css");
const path = require('path');
const webpack = require("webpack");
const apiKey = JSON.stringify(process.env.SHOPIFY_API_KEY);
module.exports = withCSS({
webpack: config => {
const env = { API_KEY: apiKey };
config.plugins.push(new webpack.DefinePlugin(env));
config.node = {fs: "empty"};
config.entry = path.join(__dirname, "devSpecific/index.tsx");
config.output = {
filename : "devSpecific/output.js"
};
config.node = {fs: 'empty'};
config.devServer = {
port: 3000
, contentBase : [path.join(__dirname, 'devSpecific')]
, hot : true
, historyApiFallback : true
};
return config;
}
});
有人知道什么可能导致webpack文件分块吗?