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

fix(devtools): fix __VUE_PROD_DEVTOOLS__ defined in cjs build (#1991) #1992

Merged
merged 6 commits into from Jun 1, 2021
Merged
Changes from 1 commit
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: 4 additions & 1 deletion rollup.config.js
Expand Up @@ -27,6 +27,7 @@ function createEntries() {
function createEntry(config) {
const isGlobalBuild = config.format === 'iife'
const isBundlerBuild = config.format !== 'iife' && !config.browser
const isBundlerESMBuild = /esm-bundler/.test(format)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it should be const isBundlerESMBuild = config.format === 'es'
otherwise I cannot build and told me format is not defined

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh damn sorry, it should be config.format 😓 Fixed!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But why it can pass unit test🤔, and I think isBundlerESMBuild will always be false, because no config.format can pass the regex

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah because I think I'm drunk or something... it should be config.file... 🤮

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's finally fixed...!

Copy link
Contributor Author

@cokemine cokemine Jun 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh, it's same. But I know what you mean, and I think it's better to be const isBundlerESMBuild = config.format === 'es', which is consistent in format

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK good point. Just updated to not include esm-browser builds.

const isBundlerESMBuild = config.format === 'es' && !config.browser

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! I think it's finished now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌 🙌 🙌 🙌 🙌

Thank you so much for your patients! 🤝


const c = {
external: ['vue'],
Expand Down Expand Up @@ -61,7 +62,9 @@ function createEntry(config) {
__DEV__: isBundlerBuild
? `(process.env.NODE_ENV !== 'production')`
: config.env !== 'production',
__VUE_PROD_DEVTOOLS__: isBundlerBuild ? 'false' : '__VUE_PROD_DEVTOOLS__'
__VUE_PROD_DEVTOOLS__: isBundlerESMBuild
? '__VUE_PROD_DEVTOOLS__'
: 'false'
}))

if (config.transpile !== false) {
Expand Down