Skip to content

Commit b749155

Browse files
committed
Remove build things, sourceMapsPathChangerPlugin
1 parent 2ed8ace commit b749155

File tree

1 file changed

+2
-55
lines changed

1 file changed

+2
-55
lines changed

vite.config.js

Lines changed: 2 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,12 @@
1-
import {defineConfig, splitVendorChunkPlugin} from "vite";
1+
import {defineConfig} from "vite";
22
import vue from "@vitejs/plugin-vue";
33

44
export default defineConfig({
55
plugins: [
66
vue(),
7-
splitVendorChunkPlugin(),
87
],
98
server: {
109
open: "/"
1110
},
12-
base: "./", // Required for GitHub Pages
13-
build: {
14-
target: "es2020",
15-
sourcemap: true,
16-
rollupOptions: {
17-
plugins: [
18-
sourceMapsPathChangerPlugin([
19-
// Use "../../" instead of "../" if resources are in "assets/" directory
20-
["../node_modules/", "node-modules:///"],
21-
["../vite/", "node-modules:///vite/"],
22-
["../src/", "source-maps:///"],
23-
["../", "source-maps:///"],
24-
]),
25-
],
26-
output: {
27-
entryFileNames: `[name].js`, // `[name].[hash].[format].js`
28-
chunkFileNames: `[name].js`,
29-
assetFileNames: `[name].[ext]`,
30-
}
31-
},
32-
minify: "terser",
33-
terserOptions: {
34-
mangle: {
35-
keep_classnames: true,
36-
keep_fnames: true,
37-
}
38-
}
39-
}
11+
base: "./",
4012
});
41-
42-
function sourceMapsPathChangerPlugin(pathsMapping = []) {
43-
function changeSourceMapPaths(map) {
44-
function _beautify(str) {
45-
return pathsMapping.reduce((pre, [value, replacer]) => {
46-
return pre.replace(value, replacer)
47-
}, str);
48-
}
49-
for (let i = 0; i < map.sources.length; i++) {
50-
map.sources[i] = _beautify(map.sources[i]);
51-
}
52-
return map;
53-
}
54-
return {
55-
name: "source-maps-path-changer-plugin",
56-
async generateBundle(options, bundle, isWrite) {
57-
Object.keys(bundle).forEach(key => {
58-
const map = bundle[key]?.map;
59-
if (map) {
60-
bundle[key].map = changeSourceMapPaths(map);
61-
}
62-
});
63-
}
64-
}
65-
}

0 commit comments

Comments
 (0)