linkerd2/web/app/webpack.config.js

75 lines
1.7 KiB
JavaScript

/* global require, module, __dirname */
const path = require('path');
module.exports = {
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
entry: './js/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
publicPath: 'dist/',
filename: 'index_bundle.js'
},
devtool: 'cheap-module-source-map',
externals: {
cheerio: 'window',
'react/addons': 'react',
'react/lib/ExecutionEnvironment': 'react',
'react/lib/ReactContext': 'react',
'react-addons-test-utils': 'react-dom',
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: [
'babel-loader',
{
loader: 'eslint-loader',
options: {
fix: true,
emitWarning: process.env.NODE_ENV === 'development'
}
}
]
},
{
test: /\.css$/,
use: [
'style-loader',
{ loader: 'css-loader', options: { importLoaders: 1, minimize: true } },
'postcss-loader'
]
},
{
test: /\.(png|jpg|gif|eot|svg|ttf|woff|woff2)$/,
use: [
{
loader: 'file-loader',
options: {
name: 'img/[name].[ext]'
}
}
]
},
{
test: /\.less$/,
use: [
'style-loader',
'css-loader',
{
loader: 'less-loader',
options: {
modifyVars: {
'font-family': '\'Roboto\', \'Lato\', helvetica, arial, sans-serif'
},
javascriptEnabled: true
}
}
]
}
]
}
}