Comments (19)
There's a slightly different version on the develop branch. Do you want to give it a go and tell me if it still happens? (I mean using the cacheIdentifier)
from babel-loader.
I'm closing this due inactivity.
It's possible to use the cacheIdentifier
as a cache buster, by saving any string in there.
Anything else just give it a shout and I'll re-open the issue.
from babel-loader.
This came up for us on react-bootstrap/react-bootstrap#840 - it'd be great if cacheIdentifier
could use more than just the versions, and also look at the Babel configuration as well, in the case of e.g. changes to .babelrc
.
from babel-loader.
If you want to change the cacheIdentifier
everytime the .babelrc
changes... why don't you just JSON.stringify()
the contents of .babelrc
into the loader options? It should accept any string you want.
Either that or I might not be understanding the problem correctly.
from babel-loader.
I could certainly do that, but I think it would be nice if babel-loader
took care of this automatically.
The reason I think that's the case is because we saw an issue where we added "runtime"
to "optionals"
in .babelrc
, but we wouldn't see the webpack output change, because the cache wasn't invalidated.
I believe this kind of condition where a user changes .babelrc
and then expects to see the webpack output change despite using cacheDirectory
is common enough that it should be generally supported.
from babel-loader.
I can easily agree that the user would expect the cache to be invalidated, however I'm not sure if it's the loader's responsibility to actually gather info from .babelrc
, but I can at least try....
Anyway, I'll try to work on this tomorrow morning, since it's quite late in here.
Meanwhile I'm open to PRs
from babel-loader.
Sadly it's going to be a bit messy, because I think you'd have to use https://github.com/babel/babel/blob/master/src/babel/transformation/file/options/resolve-rc.js , which is likely to make @sebmck unhappy.
But I don't know if there's a better option.
from babel-loader.
If you hotlink to my internal APIs then I will cry
from babel-loader.
@sebmck you and me... specially because babel moves really fast which would mean constant updates on my part. Might try to duplicate the resolve rc functionality into the loader.
but anyway... so far it's just me talking, I will try to mess around to see what I can do.
from babel-loader.
Ok... sorry for taking so long, I'm having a hard time to find some free time.
A proof of concept can be found on the feature/resolve-rc... it's hardly tested, but it seems to work on my examples. I was wondering if you're up to test it on your project, and I'm open for opinions.
The option to use .babelrc
as cacheIdentifier is opt-in, so you'll have to specify that you want to include it like so:
loaders: [{
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/,
query: {
babelrc: true,
cacheDirectory: true,
}
}]
from babel-loader.
This is really cool, thanks. What's the benefit of making this opt-in rather than opt-out? It seems like one would usually strongly prefer to have this feature, no?
BTW, might make sense to use https://www.npmjs.com/package/json-stable-stringify instead of the standard JSON.stringify
to ensure that hashes don't change spuriously.
from babel-loader.
The reason why it's opt-in is mostly to avoid a new unexpected behaviour for the ones already using the cache feature.
Still... this is a work in progress. I'm happy for any input :)
On June 18, 2015 5:45:34 PM GMT+01:00, Jimmy Jia [email protected] wrote:
This is really cool, thanks. What's the benefit of making this opt-in
rather than opt-out? It seems like one would usually strongly prefer to
have this feature, no?BTW, might make sense to use
https://www.npmjs.com/package/json-stable-stringify instead of the
standardJSON.stringify
to ensure that hashes don't change
spuriously.
Reply to this email directly or view it on GitHub:
#62 (comment)
Sent from my Android device with K-9 Mail. Please excuse my brevity.
from babel-loader.
I really like this, BTW. I think I'd pretty much use it everywhere.
from babel-loader.
I like this feature a lot and would switch to using it in all cases where I'm currently using cache directory, as it will allow me to get rid of fragile logic for bypassing the cache only for particular builds. Are there any concerns preventing it from being merged?
from babel-loader.
I've just merged this feature.
The .babelrc
is included automatically, no opt-in required.
You can find this on npm with the version 5.2.0
from babel-loader.
Awesome. Thanks!
from babel-loader.
I'm closing this, since it has been merged.
If you find any errors/bugs please reopen :)
from babel-loader.
I haven't tested it, but does this work if the .babelrc
-config is in package.json
? https://babeljs.io/docs/usage/babelrc/#use-via-package-json
from babel-loader.
At the moment it doesn't, however a PR should not be too hard :)
from babel-loader.
Related Issues (20)
- [Bug]: TypeError: this.getOptions is not a function + SPFx HOT 8
- @babel/plugin-transform-optional-chaining, configuration does not take effect HOT 1
- BunnyJs
- `module.exports` is returned instead of `module.exports.default` when importing from node_modules HOT 1
- Plugin transform-runtime generates incorrect commonjs wrapper HOT 2
- Issue while creating build for React JS Application HOT 6
- unknow option .default HOT 5
- Adding ES6 `import("find-cache-dir");` should be a breaking change. HOT 7
- You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders | HOT 1
- [Bug]: HOT 2
- export default is not a function
- Refresh time is too slow in expo react-native project after upgrade HOT 14
- Babel-loader Cache - unable to cache in changing directory environment HOT 3
- After upgrade my nodejs version 16.8.0 to 16.9.0, I am getting this error "You may need an additional loader to handle the result of these loaders" HOT 1
- Bug Error Run npm ci npm ERR! Cannot read property '@babel/cli' of undefined npm ERR! HOT 1
- Feature request: Different browserslistEnv based on webpack target. HOT 1
- You may need additional loaders
- semver vulnerable to Regular Expression Denial of Service HOT 3
- Bump semver dependency to >= 7.5.2 HOT 1
- Vulnerable dependencies (indirect security issues) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from babel-loader.