Skip to content

Instantly share code, notes, and snippets.

@bjankord
Created August 12, 2017 00:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjankord/918675c54b0d72d149ce33dca332f264 to your computer and use it in GitHub Desktop.
Save bjankord/918675c54b0d72d149ce33dca332f264 to your computer and use it in GitHub Desktop.
webpack-config.js
const webpack = require('webpack');
const path = require('path');
const Autoprefixer = require('autoprefixer');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const I18nAggregatorPlugin = require('terra-i18n-plugin');
const i18nSupportedLocales = require('terra-i18n/lib/i18nSupportedLocales');
const CustomProperties = require('postcss-custom-properties');
module.exports = {
entry: {
'babel-polyfill': 'babel-polyfill',
'myEntryPoint': path.resolve(path.join(__dirname, 'src', 'Index')),
},
module: {
loaders: [{
test: /.(jsx|js)$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
{
test: /.(scss|css)$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [{
loader: 'css-loader',
options: {
sourceMap: true,
importLoaders: 2,
localIdentName: '[path]___[name]__[local]___[hash:base64:5]',
},
}, {
loader: 'postcss-loader',
options: {
plugins() {
return [
Autoprefixer({
browsers: [
'ie >= 10',
'last 2 versions',
'last 2 android versions',
'last 2 and_chr versions',
'iOS >= 8',
],
}),
CustomProperties(),
];
},
},
},
{
loader: 'sass-loader',
}],
}),
},
],
},
plugins: [
new ExtractTextPlugin('[name]-[hash].css'),
new I18nAggregatorPlugin({
baseDirectory: __dirname,
supportedLocales: i18nSupportedLocales,
}),
new webpack.NamedChunksPlugin(),
],
resolve: {
extensions: ['.js', '.jsx'],
modules: [path.resolve(__dirname, 'aggregated-translations'), 'node_modules'],
},
output: {
filename: '[name].js',
path: path.join(__dirname, 'dist'),
},
resolveLoader: {
modules: [path.resolve(path.join(__dirname, 'node_modules'))],
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment