How to use noParse in webpack?

I want to exclude this from my webpack file using the below line of code.

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

But no matter what I try, I keep talking about errors like

ReferenceError: Unknown plugin "add-module-exports" specified in C: /..../ node_modules \ localforage \ .babelrc

Here is my webpack config file:

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'
     })
  ]
};

      

+4


source to share


1 answer


You can use the version localForage 1.3+

with webpack. You have to add noParse

to your config.



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'
        })
    ]
};

      

0


source







All Articles