npm init -y
npm install webpack --save-dev
Note: run webpack command and it'll prompt you to do so or do it manually.
create the 'src' directory containing the index.js, also create the 'dist' directory containing the main.js file to fix the issue.
webpack
node_modules/.bin/webpack
-
ES export/import
export default function(message) { alert(message); }
import notify from './Notification';
-
ES multi-function exports, import must specify each within {...}
import {notify} from './Notification';
-
Common js export/import
module.exports = function(message) { alert(message); }
var notify = require('./Notification');
npm install css-loader --save-dev
npm install style-loader --save-dev
ES compilation using Babel loader install useful docs(https://babeljs.io/setup):
npm install --save-dev babel-loader @babel/core
npm install @babel/preset-env --save-dev
To specify NODE_ENV across platforms pre-append 'env' to the variable:
env NODE_ENV=development webpack
npm install sass-loader node-sass --save-dev
npm install --save-dev mini-css-extract-plugin
npm install file-loader --save-dev
npm i -D purgecss-webpack-plugin
npm install clean-webpack-plugin --save-dev
EX: image-loader