I want to exclude this from my webpack file, by using this line of code given to me below.
noParse: /node_modules\/localforage\/dist\/localforage.js/,
But no matter what I try I it keeps on saying 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'
})
]
};
I want to exclude this from my webpack file, by using this line of code given to me below.
noParse: /node_modules\/localforage\/dist\/localforage.js/,
But no matter what I try I it keeps on saying 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'
})
]
};
Share
Improve this question
edited Jul 22, 2017 at 9:31
Dovydas Šopa
2,3008 gold badges28 silver badges34 bronze badges
asked Jul 21, 2017 at 18:44
Mr.BanksMr.Banks
4372 gold badges7 silver badges20 bronze badges
4
-
it's not very clear. Where is
noParse: /node_modules\/localforage\/dist\/localforage.js/,
written? – Stanislav Mayorov Commented Jul 21, 2017 at 20:35 - well I am not familiar with webpack, I want to exclude node_modules and localforage.js but I dont know where to do it. – Mr.Banks Commented Jul 21, 2017 at 21:15
-
You shouldn't exclude
node_modules
. why do you want to excludenode_modules
folder? – Stanislav Mayorov Commented Jul 21, 2017 at 21:26 -
I dont know why also, but thats what this module is telling me to do for it to work with webpack
https://github./localForage/localForage
it saysWebpack will emit a warning about using a prebuilt javascript file which is fine. If you want to remove the warning you should exclude localforage from being parsed by webpack using the following conf : module: { noParse: /node_modules\/localforage\/dist\/localforage.js/, loaders: [...],
I want to be able to use the LocalForage – Mr.Banks Commented Jul 21, 2017 at 21:30
1 Answer
Reset to default 0You can use localForage 1.3+
version with webpack. You should add noParse
in 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'
})
]
};