Skip to content

Instantly share code, notes, and snippets.

@liperuf
Last active April 19, 2017 19:08
Show Gist options
  • Select an option

  • Save liperuf/a867de74013fee8be3f1a12da7f8e999 to your computer and use it in GitHub Desktop.

Select an option

Save liperuf/a867de74013fee8be3f1a12da7f8e999 to your computer and use it in GitHub Desktop.
Raw project bootstrap with Webpack 2
npm i -D babel-core babel-loader babel-preset-env copy-webpack-plugin css-loader extract-text-webpack-plugin sass-loader style-loader webpack webpack-dev-server node-sass webpack-notifier
"scripts": {
"start": "webpack-dev-server --inline",
"build": "webpack -p"
},
.
├── README.md
├── app
│   ├── images
│   ├── index.html
│   ├── scripts
│   │   └── main.js
│   └── styles
├── dist
│   ├── index.html
│   └── main.js
├── package.json
└── webpack.config.js
const path = require('path')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const WebpackNotifierPlugin = require('webpack-notifier')
module.exports = {
entry: './app/scripts/main.js',
output: {
filename: 'main.js',
path: path.resolve(__dirname, 'dist')
},
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
options: { presets: ["env"] }
},
{
test: /\.s[ac]ss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
'css-loader',
'sass-loader'
]
})
}
]
},
plugins: [
new WebpackNotifierPlugin(),
new ExtractTextPlugin("styles.css"),
new CopyWebpackPlugin([
{
from: './app/index.html'
}
])
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment