- Now we have 2 entry files and 2 bundles - The vendor file houses code that is less likely to change, 3rd party libraries - The main file has all of our app code
41 lines
820 B
JavaScript
41 lines
820 B
JavaScript
const path = require("path");
|
|
var HtmlWebpackPlugin = require("html-webpack-plugin");
|
|
|
|
module.exports = {
|
|
entry: {
|
|
main: "./src/index.js",
|
|
vendor: "./src/vendor.js"
|
|
},
|
|
plugins: [
|
|
new HtmlWebpackPlugin({
|
|
template: "./src/template.html"
|
|
})
|
|
],
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.scss$/,
|
|
use: [
|
|
"style-loader", //3. Inject styles into DOM
|
|
"css-loader", //2. Turns css into commonjs
|
|
"sass-loader" //1. Turns sass into css
|
|
]
|
|
},
|
|
{
|
|
test: /\.html$/,
|
|
use: ["html-loader"]
|
|
},
|
|
{
|
|
test: /\.(svg|png|jpg|gif)$/,
|
|
use: {
|
|
loader: "file-loader",
|
|
options: {
|
|
name: "[name].[hash].[ext]",
|
|
outputPath: "imgs"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
};
|