Answer the question
In order to leave comments, you need to log in
How to include bower in webpack?
I include the library in main.js, but nothing works. I get ERROR in ./app/public/javascripts/main.js
Module not found:
Here is the webpack.config:
const HtmlWebPackPlugin = require("html-webpack-plugin");
module.exports = {
entry: './app/public/javascripts/main.js',
output: {
filename: './bundle.js'
},
module: {
rules: [
{
test: /\.js$/,
exclude: ["bower_components", "node_modules"],
use: {
loader: "babel-loader"
}
},
{
test: /\.html$/,
use: [
{
loader: "html-loader",
options: { minimize: true }
}
]
}
]
},
plugins: [
new HtmlWebPackPlugin({
template: "./app/public/index.html",
filename: "./index.html",
inject: true
})
]
};
Answer the question
In order to leave comments, you need to log in
const HtmlWebPackPlugin = require("html-webpack-plugin");
module.exports = {
entry: './app/public/javascripts/main.js',
output: {
filename: './bundle.js'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /\.node_modules/,
use: {
loader: "babel-loader"
}
},
{
test: /\.html$/,
use: [
{
loader: "html-loader",
options: { minimize: true }
}
]
}
]
},
node: {
fs: "empty"
},
plugins: [
new HtmlWebPackPlugin({
template: "./app/public/index.html",
filename: "./index.html",
inject: true
})
]
};
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question