Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For scope hoisting, Asset IDs cannot contain + or / (base64) #2681

Merged
merged 3 commits into from Feb 25, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/core/parcel-bundler/src/assets/VueAsset.js
Expand Up @@ -2,6 +2,7 @@ const Asset = require('../Asset');
const localRequire = require('../utils/localRequire');
const md5 = require('../utils/md5');
const {minify} = require('terser');
const t = require('@babel/types');

class VueAsset extends Asset {
constructor(name, options) {
Expand Down Expand Up @@ -72,10 +73,10 @@ class VueAsset extends Asset {

// TODO: make it possible to process this code with the normal scope hoister
if (this.options.scopeHoist) {
optsVar = `$${this.id}$export$default`;
optsVar = `$${t.toIdentifier(this.id)}$export$default`;

if (!js.includes(optsVar)) {
optsVar = `$${this.id}$exports`;
optsVar = `$${t.toIdentifier(this.id)}$exports`;
if (!js.includes(optsVar)) {
supplemental += `
var ${optsVar} = {};
Expand Down