-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
Babel config is cached between builds #3275
Comments
We respect the babel.config.js when generating cache keys for cache-loader here: https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-plugin-babel/index.js#L46 But the problem is: it uses the files content as a string for the key: https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-service/lib/PluginAPI.js#L163 this means the cache key is correctly invalidated when you actually change the code in We could do something like this instead: .options(api.genCacheConfig('babel-loader', {
'@babel/core': require('@babel/core/package.json').version,
'@vue/babel-preset-app': require('@vue/babel-preset-app/package.json').version,
'babel-loader': require('babel-loader/package.json').version,
modern: !!process.env.VUE_CLI_MODERN_BUILD,
browserslist: api.service.pkg.browserslist,
+ babelConfig: JSON.stringify(require(api.resolve('babel.config.js')))
}, [
- 'babel.config.js',
'.browserslistrc'
])) ...with some error handling added. |
As a workaround for the time being, I suggest to empty the cache before building: "build:demo": "rimraf node_modules/.cache && vue-cli-service build --dest demo"
"build:lib": "rimraf node_modules/.cache && cross-env BUILD_LIB=1 vue-cli-service build --target lib src/components/test.js", |
Version
3.3.0
Environment info
expand
Steps to reproduce
I'm building a lib with a demo page with vue-cli
I have following npm scripts:
and
in babel.config.js
npm run build
useBuiltIns
is not turnedfalse
upon the lib buildI have to run builds separately, with
rm -rf ./node_modules/.cache
in between to cleanup the config cache.What is expected?
Babel config should be resolved separately between builds
What is actually happening?
Cached babel config
It seems .env variables are not injected before resolve babel config 😣.
The text was updated successfully, but these errors were encountered: