Created
February 13, 2017 17:38
-
-
Save piecyk/4400a5f48893cc7d42a20da74fbb39a5 to your computer and use it in GitHub Desktop.
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
| import path from 'path'; | |
| import webpack from 'webpack'; | |
| import BowerWebpackPlugin from 'bower-webpack-plugin'; | |
| const isDevelopmentMode = true; | |
| const isHot = false; | |
| const srcPath = path.resolve(__dirname, 'src'); | |
| const outPath = path.resolve(__dirname, 'dist'); | |
| const options = { | |
| entry: { | |
| app: [ | |
| ...isHot ? [ | |
| 'react-hot-loader/patch', | |
| 'webpack-dev-server/client?http://localhost:8080', | |
| 'webpack/hot/only-dev-server' | |
| ] : [], | |
| path.resolve(srcPath, 'index.js') | |
| ] | |
| }, | |
| output: { | |
| path: path.resolve(outPath), | |
| filename: 'assets/app.js', | |
| publicPath: '/', | |
| pathinfo: true | |
| }, | |
| resolve: { | |
| modules: ['./node_modules', './src'], | |
| extensions: ['.js', '.jsx', '.json'], | |
| alias: { | |
| config: path.resolve(srcPath, 'config/dev.js') // todo | |
| } | |
| }, | |
| devServer: { | |
| port: 8081, | |
| path: path.resolve(outPath), | |
| contentBase: srcPath, | |
| historyApiFallback: true, | |
| publicPath: '/' | |
| }, | |
| module: { | |
| rules: [ | |
| { | |
| test: /\.js$/, | |
| use: ['babel-loader'], | |
| exclude: /node_modules/ | |
| }, | |
| { | |
| test: /\.css$/, | |
| use: [ | |
| 'style-loader', | |
| 'css-loader?importLoaders=1', | |
| 'postcss-loader' | |
| ] | |
| }, | |
| { | |
| test: /\.scss/, | |
| use: [ | |
| 'style-loader', | |
| 'css-loader', | |
| 'sass-loader?outputStyle=expanded' | |
| ] | |
| }, | |
| { | |
| test: /\.(png|jpg|gif|woff|woff2)$/, | |
| use: [ | |
| 'url-loader?limit=8192' | |
| ] | |
| }, | |
| { | |
| test: /\.(mp4|ogg|svg)$/, | |
| use: [ | |
| 'file-loader' | |
| ] | |
| }, | |
| { | |
| test: /masonry|imagesloaded|fizzy\-ui\-utils|desandro\-|outlayer|get\-size|doc\-ready|eventie|eventemitter/, | |
| use: [ | |
| 'imports-loader?define=>false&this=>window' | |
| ] | |
| } | |
| ] | |
| }, | |
| plugins: [ | |
| new webpack.LoaderOptionsPlugin({ | |
| debug: isDevelopmentMode, | |
| options: { | |
| resolve: {}, | |
| postcss: () => [] | |
| } | |
| }), | |
| new webpack.ProgressPlugin(), | |
| new webpack.NamedModulesPlugin(), | |
| new BowerWebpackPlugin({ | |
| searchResolveModulesDirectories: false | |
| }) | |
| ] | |
| }; | |
| export default options; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment