Use this config as a starter point to compile Javascript ES6 and Sass using webpack.
In this configuration, webpack compiles sass in a separate css file with Autoprefixer
and source map
.
To start watching and compile the app run:
npm run webpack
Modify the webpack configuration file webpack.config.js
to change or add more functionality. Official doc
By default, webpack is set to development
change inside webpack.config.js
the property mode from development
to production
this will also minify all the javascript and css files.
link the app inside the project:
<script src="dist/app.js"></script>
<script src="dist/vendor.js"></script>
<link rel="stylesheet" href="dist/css/main.css">
If the file name it's the same for both, javascript and css files (for example main.js
and main.css
) use:
entry: {
main: ["./main.js","./sass/main.scss"],
}