Skip to content

Instantly share code, notes, and snippets.

@mstrlaw
Created May 17, 2020 14:02
Show Gist options
  • Save mstrlaw/09e20406cb54bcd116ba8e9dc4c742f7 to your computer and use it in GitHub Desktop.
Save mstrlaw/09e20406cb54bcd116ba8e9dc4c742f7 to your computer and use it in GitHub Desktop.
const path = require('path');
const fs = require('fs');
const EventHooksPlugin = require('event-hooks-webpack-plugin');
module.exports = {
chainWebpack: (config) => {
config.devServer.headers({
'Access-Control-Allow-Origin': '*',
});
config.devServer.set('disableHostCheck', false);
config.devServer.set('sockPort', 8080);
config.devServer.set('sockHost', 'localhost');
config.devServer.set('port', 8080);
config.devServer.set('inline', false);
config.devServer.set('hot', true);
config.output.filename('[name].js');
config.output.publicPath('/');
config.externals([
'vue',
'vue-router'
]);
},
lintOnSave: true,
filenameHashing: false,
configureWebpack: {
plugins: [
new EventHooksPlugin({
done: () => {
if (process.env.NODE_ENV !== 'development') {
const buildDir = path.join(__dirname, '/dist');
fs.unlinkSync(`${buildDir}/index.html`);
}
},
}),
],
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment