Skip to content

Commit

Permalink
update build
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremykenedy committed Jan 8, 2023
1 parent d719d35 commit 94918db
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"vite-plugin-imagemin": "^0.5.3",
"vite-plugin-inspect": "^0.7.12",
"vite-plugin-manifest-sri": "^0.1.0",
"vite-plugin-minify": "^1.5.2",
"vite-plugin-pages": "^0.28.0",
"vite-plugin-pages-sitemap": "^1.4.5",
"vite-plugin-pwa": "^0.14.0",
Expand Down
21 changes: 20 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,24 @@ import { createHtmlPlugin } from 'vite-plugin-html';
import manifestSRI from 'vite-plugin-manifest-sri';
import { viteCommonjs } from '@originjs/vite-plugin-commonjs';
import { esbuildCommonjs } from '@originjs/vite-plugin-commonjs';
import { ViteMinifyPlugin } from 'vite-plugin-minify'
import { dependencies } from './package.json';

const routes = () =>
import(/* webpackChunkName: "jsRoutes" */ 'resources/js/router/routes.js');

const fs = require('node:fs');

function renderChunks(deps: Record<string, string>) {
let chunks = {};
Object.keys(deps).forEach((key) => {
if (['vue', 'vue-router', 'vue-loader'].includes(key)) return;
chunks[key] = [key];
});
return chunks;
}


export default ({ mode }) => {
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) };
let SentryPlugin = null;
Expand Down Expand Up @@ -141,6 +153,9 @@ export default ({ mode }) => {
modulePreload: {
polyfill: true,
},
commonjsOptions: {
include: [/node_modules/]
},
},
plugins: [
viteStaticCopy({
Expand Down Expand Up @@ -244,7 +259,6 @@ export default ({ mode }) => {
},
],
}),
manifestSRI(),
vue({
template: {
transformAssetUrls: {
Expand Down Expand Up @@ -350,10 +364,15 @@ export default ({ mode }) => {
navigateFallback: 'index.html',
},
}),
manifestSRI(),
createHtmlPlugin({
minify: true,
entry: 'resources/js/app.js',
}),
ViteMinifyPlugin({
minifyCSS: true,
removeComments: true,
}),
viteCommonjs(),
SentryPlugin,
InspectPlugin,
Expand Down

0 comments on commit 94918db

Please sign in to comment.