我向應用程序添加了一個config.json。如何創建配置文件以進行反應並防止webpack將其捆綁?
在webpack.config.js我在我的應用所需的配置定義的配置
externals: {
'Config': JSON.stringify(production ? require('./config.prod.json') : require('./config.dev.json'))
},
,並用它
var Config = require('Config');
然而,束的WebPack我的配置文件導入到index.js(我的WebPack輸出文件),我不想要這個。 我想保持我的config.json從index.js分離爲了實現這一點,我排除了我的config.json,但它沒有奏效。
exclude: [/node_modules/, path.resolve(__dirname, 'config.dev.json'), path.resolve(__dirname, 'config.prod.json')]
如果我錯過了一些東西,你能幫我嗎? 感謝
你想單獨加載config.json嗎?或者你根本不需要config.json? – iamsaksham
我需要config.json,但我不想捆綁到webpack輸出文件 – Barny