jest-html
Version:
Preview Jest snapshots right in your browser
71 lines (58 loc) • 1.8 kB
JavaScript
/* eslint-disable no-console */
var path = require('path');
// const webpack = require('webpack');
module.exports = function () {
var env = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var fProduction = env.NODE_ENV === 'production';
console.log('Compiling for production: ' + fProduction);
var cssLoader = {
loader: 'css-loader'
};
var sassLoader = {
loader: 'sass-loader',
options: { indentedSyntax: true }
};
var styleRules = function styleRules(loaders) {
return [{ loader: 'style-loader' }].concat(loaders);
};
return {
// -------------------------------------------------
// Input (entry point)
// -------------------------------------------------
entry: { app: ['./src/client/startup.js'] },
// -------------------------------------------------
// Output
// -------------------------------------------------
output: {
filename: '[name].bundle.js',
path: path.resolve(process.cwd(), 'lib/public/assets'),
publicPath: '/assets/',
libraryTarget: undefined
},
// -------------------------------------------------
// Configuration
// -------------------------------------------------
devtool: fProduction ? undefined : 'eval',
plugins: [],
module: {
rules: [{
test: /\.(js|jsx)$/,
loader: 'babel-loader',
exclude: [/node_modules/]
}, {
test: /\.(otf|eot|svg|ttf|woff|woff2)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file-loader'
}, {
test: /\.css$/,
loader: styleRules([cssLoader])
}, {
test: /\.sass$/,
loader: styleRules([cssLoader, sassLoader])
}, {
test: /\.png$/,
loader: 'file-loader'
}]
}
};
};
;