Created
May 22, 2018 11:54
-
-
Save tlaitinen/df537aee4b5c8b4f5fe4e4ad7fb2b28f 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
| 'use strict'; | |
| var path = require('path') | |
| , webpack = require('webpack') | |
| , HtmlWebpackPlugin = require('html-webpack-plugin'); | |
| var proxySettings = { | |
| '/api/*': { | |
| target: 'http://localhost:3000', | |
| pathRewrite: { | |
| '/api' : '' | |
| } | |
| } | |
| }; | |
| module.exports = { | |
| entry: "./index.tsx", | |
| output: { | |
| path: path.resolve('../../dist/frontend'), | |
| filename: '[chunkhash].js', | |
| publicPath: '/' | |
| }, | |
| module: { | |
| rules: [ | |
| { test: /\.css$/, loader: "style-loader!css-loader" }, | |
| { | |
| test: /\.less$/, | |
| loader: "style-loader!css-loader!less-loader" | |
| }, | |
| { | |
| test: /\.json$/, | |
| loader: 'json-loader' | |
| }, | |
| { | |
| test: /\.tsx?$/, | |
| loader: [ | |
| 'jsxgettext-loader?' + JSON.stringify({outputDir: '../../locale/templates/LC_MESSAGES', output: 'messages.pot'}), | |
| 'ts-loader' | |
| ], | |
| exclude: /node_modules/ | |
| }, | |
| { | |
| test: /\.jsx?$/, | |
| use: [ | |
| 'jsxgettext-loader?' + JSON.stringify({outputDir: '../../locale/templates/LC_MESSAGES', output: 'messages.pot'}), | |
| 'babel-loader' | |
| ], | |
| exclude: /node_modules/ | |
| }, | |
| { | |
| test: /\.scss$/, | |
| use: [{ | |
| loader: "style-loader" // creates style nodes from JS strings | |
| }, { | |
| loader: "css-loader" // translates CSS into CommonJS | |
| }, { | |
| loader: "sass-loader" // compiles Sass to CSS | |
| } | |
| ] | |
| }, | |
| { | |
| test: /\.(png|gif|woff|woff2|eot|ttf|svg)($|\?v\=)/, | |
| loader: 'url-loader?limi=100000', | |
| exclude: /react-flags/ | |
| }, | |
| { | |
| test: /\.jpg$/, | |
| loaders: [ | |
| 'file-loader?' + JSON.stringify({ hash: 'sha512', digest: 'hex', name: '[hash].[ext]' }), | |
| 'image-webpack-loader' | |
| ] | |
| }, | |
| { | |
| test: /\.po$/, | |
| loader: 'json-loader!po-loader' | |
| } | |
| ] | |
| }, | |
| resolve: { | |
| alias: { | |
| '@src': '.', | |
| '@backend': '../backend' | |
| }, | |
| extensions: ['.ts', '.tsx', '.js', '.js', '.json'], | |
| }, | |
| plugins: [ | |
| new webpack.DefinePlugin({ | |
| 'process.env': { | |
| 'NODE_ENV': '"' + process.env.NODE_ENV + '"' | |
| } | |
| }), | |
| new HtmlWebpackPlugin({ | |
| title: 'Title', | |
| filename: 'index.html', | |
| favicon: '../../resources/icons/favicon.ico' | |
| }), | |
| new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /fi|en/) | |
| ], | |
| devServer: { | |
| historyApiFallback: { | |
| index: '/' | |
| }, | |
| proxy: proxySettings | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment