Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ function buildEntry (config) {
const isProd = /(min|prod)\.js$/.test(file)
return rollup.rollup(config)
.then(bundle => bundle.generate(output))
.then(async ({ output: [{ code }] }) => {
.then(async ({ output: [{ code, map }] }) => {
const hasMap = !!map;
const filename = file.split('/').pop();
if (hasMap) {
code = code + `\n//# sourceMappingURL=${filename}.map`;
write(`${file}.map`, JSON.stringify(map));
}
if (isProd) {
const {code: minifiedCode} = await terser.minify(code, {
toplevel: true,
Expand Down
3 changes: 2 additions & 1 deletion scripts/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ function genConfig(name) {
format: opts.format,
banner: opts.banner,
name: opts.moduleName || 'Vue',
exports: 'auto'
exports: 'auto',
sourcemap: !!process.env.SOURCE_MAP
},
onwarn: (msg, warn) => {
if (!/Circular/.test(msg)) {
Expand Down