callstack / callstack/parcel-plugin-linaria
Unable to import JSAsset from Parcel
- Dominant language
- JavaScript
- Stars
- 17
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
## Environment
Node v13.9.0 on Windows 10
## Description
Starting the parcel development server or building a production bundle fails as this plugin tries to import `parcel/src/assets/JSAsset`. Click to open the full stack trace below:
```js
Error: Cannot find module 'parcel/src/assets/JSAsset'
```
```js
PS C:\Users\Lilly\Projects\linaria-test> npm run build
> linaria-test@1.0.0 build C:\Users\Lilly\Projects\linaria-test
> parcel build index.html
‼ Parser "parcel-plugin-linaria\src\LinariaAsset.js" failed to initialize when processing asset "index.js". Threw the following error:
Error: Cannot find module 'parcel/src/assets/JSAsset'
Require stack:
- C:\Users\Lilly\Projects\linaria-test\node_modules\parcel-plugin-linaria\src\LinariaAsset.js
- C:\Users\Lilly\Projects\linaria-test\node_modules\parcel-bundler\src\Parser.js
- C:\Users\Lilly\Projects\linaria-test\node_modules\parcel-bundler\src\Bundler.js
- C:\Users\Lilly\Projects\linaria-test\node_modules\parcel-bundler\index.js
- C:\Users\Lilly\Projects\linaria-test\node_modules\parcel-bundler\src\cli.js
- C:\Users\Lilly\Projects\linaria-test\node_modules\parcel-bundler\bin\cli.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
at Function.Module._load (internal/modules/cjs/loader.js:862:27)
at Module.require (internal/modules/cjs/loader.js:1040:19)
at require (C:\Users\Lilly\Projects\linaria-test\node_modules\v8-compile-cache\v8-compile-cache.js:161:20)
at Object. (C:\Users\Lilly\Projects\linaria-test\node_modules\parcel-plugin-linaria\src\LinariaAsset.js:3:17)
at Module._compile (C:\Users\Lilly\Projects\linaria-test\node_modules\v8-compile-cache\v8-compile-cache.js:194:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Module.require (internal/modules/cjs/loader.js:1040:19) falling back to RawAsset
× Cannot read property 'length' of undefined
at lineCounter (C:\Users\Lilly\Projects\linaria-test\node_modules\parcel-bundler\src\utils\lineCounter.js:3:30)
at JSPackager.writeModule (C:\Users\Lilly\Projects\linaria-test\node_modules\parcel-bundler\src\packagers\JSPackager.js:127:60)
at async JSPackager.addAsset (C:\Users\Lilly\Projects\linaria-test\node_modules\parcel-bundler\src\packagers\JSPackager.js:88:5)
at async Bundle._addDeps (C:\Users\Lilly\Projects\linaria-test\node_modules\parcel-bundler\src\Bundle.js:250:5)
at async Bundle._package (C:\Users\Lilly\Projects\linaria-test\node_modules\parcel-bundler\src\Bundle.js:219:7)
at async Promise.all (index 0)
at async Bundle.package (C:\Users\Lilly\Projects\linaria-test\node_modules\parcel-bundler\src\Bundle.js:202:5)
at async Promise.all (index 1)
at async Bundle.package (C:\Users\Lilly\Projects\linaria-test\node_modules\parcel-bundler\src\Bundle.js:202:5)
at async Bundler.bundle (C:\Users\Lilly\Projects\linaria-test\node_modules\parcel-bundler\src\Bundler.js:325:27)
```
## Reproducible Demo
I've created a gist with a minimal copy of my setup, which also runs into this problem: https://gist.github.com/SnowyLuma/1c9a05c6f150e9b3c187fd31404bcc96
Contributor guide
Assessment
This issue has not been assessed yet.