Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Laravel Mix Webpack configuration alias and chunkFile configuration
const mix = require('laravel-mix');
require('laravel-mix-merge-manifest');
const VuetifyLoaderPlugin = require('vuetify-loader/lib/plugin');
mix.setPublicPath('../../public').mergeManifest();
mix.js(__dirname + '/Resources/assets/src/main.js', 'modules/web/app.js')
.sass( __dirname + '/Resources/assets/sass/app.scss', 'modules/web/app.css');
// mix.js(__dirname + '/res/src/main.js', 'modules/web/app.js')
// .sass( __dirname + '/Resources/assets/sass/app.scss', 'modules/web/app.css');
if (mix.inProduction()) {
mix.version();
}
mix.webpackConfig({
plugins: [
// new BundleAnalyzerPlugin(),
// new CleanWebpackPlugin({
// cleanStaleWebpackAssets: false,
// cleanOnceBeforeBuildPatterns: ['pulblic/css/*', 'public/js/*'],
// }),
new VuetifyLoaderPlugin(),
],
resolve: {
extensions: ['.js', '.json', '.vue'],
alias: {
// 'vue$': 'vue/dist/vue.esm.js',
'~': path.join(__dirname, '/Resources/assets/src'),
}
},
output: {
chunkFilename: 'modules/web/js/[name].[chunkhash].js',
publicPath: '/' // mix.config.hmr ? '//localhost:8080' : '/'
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment