Skip to content

Instantly share code, notes, and snippets.

@bishesh16
Last active May 24, 2018 14:45
Show Gist options
  • Save bishesh16/fa0c0aa38c330d27b80068ce7d9ef2a2 to your computer and use it in GitHub Desktop.
Save bishesh16/fa0c0aa38c330d27b80068ce7d9ef2a2 to your computer and use it in GitHub Desktop.
var webpack = require('webpack');
var config = {
context: __dirname + '/src', // `__dirname` is root of project and `/src` is source
entry: {
app: './main.js',
},
output: {
path: __dirname + '/dist', // `/dist` is the destination
filename: 'bundle.js', // bundle created by webpack it will contain all our app logic. we will link to this .js file from our html page.
},
module: {
rules: [
{
test: /\.js$/, // rule for .js files
exclude: /node_modules/,
loader: "babel-loader" // apply this loader for js files
},
{
test: /\.css$/,
use: [
'style-loader', // the order is important. it executes in reverse order !
'css-loader' // this will load first !
]
}
]
}
};
module.exports = config;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment