IE11以下兼容性问题

定位到报错代码,发现使用了const语法,这个语法是IE11之后才兼容,但是项目也都配了babel-polyfill, 按理说babel-loader编译后,代码里不应该有const这个语法了。

问题原因在于,babel-loader没有处理node_modules 里npm包,而一些包是不支持IE11以下的,使用了const语法,这个语法没有经过bable处理。

那么如何解决,在babel-loader中手动指定需要额外处理的npm包

1
2
3
4
5
6
7
test: /\.jsx?$/,
loader: 'babel-loader',
include: [

/node_modules[\\/]react-popover/,

],