| const commonBuilder = require('pulito'); |
| const CopyWebpackPlugin = require('copy-webpack-plugin'); |
| const HtmlWebpackInjectAttributesPlugin = require('html-webpack-inject-attributes-plugin'); |
| const { resolve } = require('path'); |
| |
| module.exports = (env, argv) => { |
| const config = commonBuilder(env, argv, __dirname); |
| config.output.publicPath = '/static/'; |
| |
| config.plugins.push( |
| new CopyWebpackPlugin([ |
| { |
| from: resolve(__dirname, 'images/icon.png'), |
| to: 'icon.png', |
| }, |
| { |
| from: resolve(__dirname, 'images/icon-active.png'), |
| to: 'icon-active.png', |
| }, |
| ]), |
| ); |
| config.plugins.push( |
| new HtmlWebpackInjectAttributesPlugin({ |
| nonce: '{%.nonce%}', |
| }), |
| ); |
| config.resolve = config.resolve || {}; |
| // https://github.com/webpack/node-libs-browser/issues/26#issuecomment-267954095 |
| config.resolve.modules = [resolve(__dirname, 'node_modules')]; |
| return config; |
| }; |