Newer
Older
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
const apiUrl = typeof process.env.API_URL !== 'undefined' ? process.env.API_URL : 'http://localhost:3001/api/v1'
/**
* All files inside webpack's output.path directory will be removed once, but the
* directory itself will not be. If using webpack 4+'s default configuration,
* everything under <PROJECT_DIR>/dist/ will be removed.
* Use cleanOnceBeforeBuildPatterns to override this behavior.
*
* During rebuilds, all webpack assets that are not used anymore
* will be removed automatically.
*/
new CleanWebpackPlugin(),
template: 'src/client/index.html',
favicon: 'src/client/favicon.ico'
new webpack.HotModuleReplacementPlugin(),
new webpack.DefinePlugin({
'process.env.API_URL': JSON.stringify(apiUrl)
})
loader: 'file-loader',
options: {
outputPath: 'images'
}