12345678910111213141516171819202122232425262728 |
- const path = require("path"); // NodeJS builtin.
- module.exports = {
- entry: "./src/index.js",
- output: {
- filename: "bundle.js",
- path: path.join(__dirname, "build") // path must be absolute.
- },
- module: {
- rules: [
- {
- // When a file name matches this expression...
- test: /\.js$/,
- // ...use that loader on it.
- use: "babel-loader"
- },
- {
- test: /\.scss$/,
- use: [
- // Apply down to top (right to left), like wrapped function calls.
- "style-loader", // Apply third: insert script tag for browser use.
- "css-loader", // Apply second: convert CSS to JS.
- "sass-loader" // Apply first: compile SASS to CSS.
- ]
- }
- ]
- }
- };
|