Created
May 11, 2017 03:19
-
-
Save abhirathore2006/1786279dc0896d29a70a952c6ddbde39 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
| var path = require('path'); | |
| var webpack = require('webpack'); | |
| const ExtractTextPlugin = require('extract-text-webpack-plugin'); | |
| const extractStyle = new ExtractTextPlugin({ | |
| filename: "css/bundle.min.css" | |
| }); | |
| var loaders = [ | |
| { | |
| test: /\.css$/, | |
| loader: extractStyle.extract({ | |
| use: [{ | |
| loader: "css-loader" | |
| },{ | |
| loader: 'postcss-loader', | |
| options: { | |
| plugins: function () { | |
| return [ | |
| require('autoprefixer') | |
| ]; | |
| } | |
| } | |
| }], | |
| fallback: "style-loader" | |
| }) | |
| }, | |
| { | |
| test: /\.less$/, | |
| loader: extractStyle.extract({ | |
| use: [{ | |
| loader: "css-loader" | |
| },{ | |
| loader: 'postcss-loader', | |
| options: { | |
| plugins: function () { | |
| return [ | |
| require('autoprefixer') | |
| ]; | |
| } | |
| } | |
| },{ | |
| loader: "less-loader" | |
| }], | |
| // use style-loader in development | |
| fallback: "style-loader" | |
| }) | |
| }, | |
| { | |
| test: /\.ts(x?)$/, | |
| include: path.join(__dirname, 'src'), | |
| use: [ | |
| { | |
| loader: 'awesome-typescript-loader', | |
| options: { | |
| useCache: true, | |
| useBabel: true | |
| } | |
| } | |
| ] | |
| }, | |
| { | |
| test: /\.(jpg|png|gif)$/, | |
| use: 'file-loader' | |
| }, { | |
| test: /\.(woff|woff2|eot|ttf|svg)$/, | |
| use: { | |
| loader: 'url-loader', | |
| options: { | |
| limit: 100000 | |
| } | |
| } | |
| } | |
| ] | |
| module.exports = { | |
| devtool: 'eval', | |
| entry: [ | |
| 'webpack-hot-middleware/client?reload=true', | |
| './src/client/index.tsx' | |
| ], | |
| output: { | |
| path: path.join(__dirname, './src/client/assets'), | |
| filename: 'bundle.js', | |
| publicPath: '/' | |
| }, | |
| plugins: [ | |
| extractStyle, | |
| new webpack.HotModuleReplacementPlugin(), | |
| new webpack.NoEmitOnErrorsPlugin(), | |
| new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/) // Ignore all optional deps of moment.js | |
| ], | |
| module: { | |
| rules: loaders | |
| }, | |
| resolve: { | |
| modules: [ | |
| path.join(__dirname, "src"), | |
| "node_modules" | |
| ], | |
| extensions: ['.jsx', '.js', '.tsx', '.ts'] | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment