Last active
April 19, 2017 19:08
-
-
Save liperuf/a867de74013fee8be3f1a12da7f8e999 to your computer and use it in GitHub Desktop.
Raw project bootstrap with Webpack 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "scripts": { | |
| "start": "webpack-dev-server --inline", | |
| "build": "webpack -p" | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| . | |
| ├── README.md | |
| ├── app | |
| │ ├── images | |
| │ ├── index.html | |
| │ ├── scripts | |
| │ │ └── main.js | |
| │ └── styles | |
| ├── dist | |
| │ ├── index.html | |
| │ └── main.js | |
| ├── package.json | |
| └── webpack.config.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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