如何在webpack中使用noParse?

我想从我的webpack文件中排除这个,通过使用下面这个给我的代码行。

noParse: /node_modules\/localforage\/dist\/localforage.js/,

但是无论我尝试什么,我都会一直说错误

ReferenceError:C:/…./ node_modules \ localforage \ .babelrc中指定的未知插件“add-module-exports”

这是我的webpackconfiguration文件:

 var path = require('path'); var HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = { entry: './app/index.js', output: { path: path.resolve(__dirname, 'dist'), filename: 'index_bundle.js', publicPath: '/' }, devServer: { historyApiFallback: true, }, module: { rules: [ { test: /\.(js)$/, use: 'babel-loader' }, { test: /\.css$/, use: [ 'style-loader', 'css-loader' ]} ] }, plugins: [ new HtmlWebpackPlugin({ template: 'app/index.html' }) ] }; 

Solutions Collecting From Web of "如何在webpack中使用noParse?"

你可以使用localForage 1.3+版本的webpack。 您应该在您的configuration中添加noParse

 var path = require('path'); var HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = { entry: './app/index.js', output: { path: path.resolve(__dirname, 'dist'), filename: 'index_bundle.js', publicPath: '/' }, devServer: { historyApiFallback: true, }, module: { noParse: /node_modules\/localforage\/dist\/localforage.js/, rules: [{ test: /\.(js)$/, exclude: /localforage/, use: 'babel-loader' }, { test: /\.css$ / , use: ['style-loader', 'css-loader'] }] }, plugins: [ new HtmlWebpackPlugin({ template: 'app/index.html' }) ] };