Skip to content

Instantly share code, notes, and snippets.

@mshustov
Created April 22, 2016 16:43
Show Gist options
  • Save mshustov/a5218f9eca5b92260e24df7d398a632c to your computer and use it in GitHub Desktop.
Save mshustov/a5218f9eca5b92260e24df7d398a632c to your computer and use it in GitHub Desktop.
var getSources = function(name) {
var filename = name.substr(templateParams.htmlWebpackPlugin.files.publicPath.length);
return templateParams.compilation.assets[filename].source();
}
templateParams.htmlWebpackPlugin.files.css.map(getSources)
templateParams.htmlWebpackPlugin.files.js.map(getSources)
merge({}, commonConfig, {
target: 'node',
entry: [
'./src/pages/internal-error/'
],
output: {
// path: './build/internalError/',
path: path.join(__dirname,'./build/public/'),
filename: '[name].js',
libraryTarget: 'umd' // important to have it here because of plugin
},
// node: {
// console: true,
// global: false,
// process: true,
// Buffer: true,
// __filename: true,
// __dirname: true,
// fs: 'empty',
// net: 'empty',
// dns: 'empty'
// },
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel',
exclude: /node_modules\//,
query: {
presets: ['babel-preset-es2015', 'babel-preset-react'],
plugins: resolveToProjectLevel(['babel-plugin-transform-class-properties'])
}
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract('style-loader', 'css?minimize!sass!sass-resources')
// loader: 'css?minimize!sass!sass-resources'
},
{ // ttf? otf? file-loader?
test: /\.(png|jpg|jpeg|gif|svg|woff|woff2|ttf)$/,
loader: 'url-loader?limit=1000000&name=[name].[hash].[ext]'
}
]
},
plugins: [
failPlugin,
new HtmlWebpackPlugin({
inject: false,
template: './src/pages/static-template/index.js'
}),
new ExtractTextPlugin('static.css'),
new webpack.ContextReplacementPlugin(/react-intl\/lib\/locale-data/, dictRegExp),
new webpack.ContextReplacementPlugin(/intl\/locale-data\/jsonp/, dictRegExp)
],
sassResources: sassResources
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment