You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ok, this goes beyond my level of understanding, but let's try.
Linaria depends on core-js@^2.0.0, and the environment where Linaria is being used should also use core-js 2, but that resolution is not necessarily up to the linaria dependency. Linaria also depends on @babel/register^7.0.0, where @babel/register@7.0.0 (without the caret) depends on core-js 2, but @babel/register@7.4.0 depends on core-js 3. This usually doesn't seem to be a problem because in the real world other dependencies seem to ultimately depend on core-js 2, so that's what it resolves to, but Linaria shouldn't rely on that coincidence.
If I have the wrong version of core-js, I get the following Babel error:
{ Error: [BABEL] /Users/silvenon/Code/test/linaria/index.js: Cannot find module 'core-js/modules/es7.array.includes' (While processing: "/Users/silvenon/Code/test/linaria/node_modules/linaria/babel.js")
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:668:15)
at Function.Module._load (internal/modules/cjs/loader.js:591:27)
at Module.require (internal/modules/cjs/loader.js:723:19)
at require (internal/modules/cjs/helpers.js:14:16)
at Object.<anonymous> (/Users/silvenon/Code/test/linaria/node_modules/linaria/lib/babel/module.js:3:1)
at Module._compile (internal/modules/cjs/loader.js:816:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
at Module.load (internal/modules/cjs/loader.js:685:32)
at Function.Module._load (internal/modules/cjs/loader.js:620:12)
at Module.require (internal/modules/cjs/loader.js:723:19) code: 'MODULE_NOT_FOUND' }
@silvenon since babel deprecated their polyfill pkg and recommended people to use core-js directly, I think lots of projects are going to depend on the latest version, which may be a problem since linaria has v2 as a dep =/
I'm fine with whatever core-js version Linaria wants, this issue was about enforcing this, so the user knows what's going on, or preferably doesn't have to.
Environment
Description
Ok, this goes beyond my level of understanding, but let's try.
Linaria depends on
core-js@^2.0.0
, and the environment where Linaria is being used should also usecore-js
2, but that resolution is not necessarily up to thelinaria
dependency. Linaria also depends on@babel/register^7.0.0
, where@babel/register@7.0.0
(without the caret) depends oncore-js
2, but@babel/register@7.4.0
depends oncore-js
3. This usually doesn't seem to be a problem because in the real world other dependencies seem to ultimately depend oncore-js
2, so that's what it resolves to, but Linaria shouldn't rely on that coincidence.If I have the wrong version of core-js, I get the following Babel error:
Reproducible Demo
Configure Babel:
Create a Linaria class name:
Try to compile it with Babel:
Solution
Temporary solution for people using Linaria:
A permanent solution for Linaria might be locking
@babel/register
to7.0.0
, but I might be off about how module resolution works. 😄The text was updated successfully, but these errors were encountered: