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

Changing compilerOptions directives in vue.config.js not working in 2.7 when building #12828

Closed
tunnelpuzzle opened this issue Oct 14, 2022 · 4 comments
Assignees

Comments

@tunnelpuzzle
Copy link

Version

2.7.12

Reproduction link

github.com

Steps to reproduce

  1. Clone the minimal reproduction repo and do npm run build. The code in vue.config.js: https://github.com/tunnelpuzzle/vue-compiler-directive/blob/master/vue.config.js#L11-L12 for the v-show directive won't be run.

  2. Switch to Vue 2.6 npm i vue@2.6.14 vue-template-compiler@2.6.14 and then do npm run build. The code to for the v-show directive is run.

What is expected?

Changing the compilerOptions directives should work in Vue 2.7 when building.

What is actually happening?

Changing the compilerOptions directives when building works in Vue 2.6 but not Vue 2.7


I looked in the release notes but couldn't find anything about this behavior changing in 2.7.

@yyx990803
Copy link
Member

/cc @sodatea this seems to be related to thread-loader not able to pass options that contain functions to worker thread (only in build).

Not sure why this behavior is different between 2.6 and 2.7. Is there some logic in vue-cli that enables/disables thread-loader on vue-loader?

For now you can work around this by setting parallel: false in vue.config.js.

@haoqunjiang
Copy link
Member

haoqunjiang commented Oct 14, 2022

Not sure why this behavior is different between 2.6 and 2.7. Is there some logic in vue-cli that enables/disables thread-loader on vue-loader?

It's in vue-loader.
Vue 2.7+ also applies js loaders to compiled <template> code, and among them is thread-loader.
Vue 2.6 template compilation doesn't go through js loaders, thus no problem.

@haoqunjiang
Copy link
Member

This issue could be mostly mitigated if we detect and skip cloning thread-loader rules in VueLoaderPlugin

haoqunjiang added a commit to vuejs/vue-loader that referenced this issue Nov 14, 2022
haoqunjiang added a commit to vuejs/vue-loader that referenced this issue Nov 14, 2022
@haoqunjiang
Copy link
Member

Fixed in vue-loader@15.10.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants