【发布时间】:2015-12-03 18:07:38
【问题描述】:
我有一个带有如下加载器的 webpack.config:
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loaders: [ 'react-hot', 'babel-loader' ]
},
{
exclude: /node_modules/,
loader: 'eslint-loader',
test: /\.js$/
}
],
我将 node_modules 排除在外,因为其他方式 react-hot 会遇到麻烦,比如 this
我的问题是:通过排除 node_module,一个需要 babel-loader 的私有 npm 包不会被加载到包中。
如何管理每个加载程序的排除?
【问题讨论】:
-
把你的私有包放在不同的地方(例如项目文件夹下的lib)可以解决这个问题。