Parcel: Error: Cannot find module './src/data'

Created on 2 Dec 2019  路  3Comments  路  Source: parcel-bundler/parcel

馃悰 bug report

Something broke really badly. 馃槵

馃槸 Current Behavior

> [email protected] start /home/stefan/playground/parcel-issue
> parcel src/index.html

Server running at http://localhost:1234 
鈿狅笍  Parser "assets/JSAsset" failed to initialize when processing asset "src/index.js". Threw the following error:
Error: Cannot find module './src/data'
Require stack:
- /home/stefan/playground/parcel-issue/node_modules/core-js-compat/helpers.js
- /home/stefan/playground/parcel-issue/node_modules/core-js-compat/get-modules-list-for-target-version.js
- /home/stefan/playground/parcel-issue/node_modules/@babel/preset-env/lib/polyfills/corejs3/usage-plugin.js
- /home/stefan/playground/parcel-issue/node_modules/@babel/preset-env/lib/index.js
- /home/stefan/playground/parcel-issue/node_modules/parcel/src/transforms/babel/env.js
- /home/stefan/playground/parcel-issue/node_modules/parcel/src/transforms/babel/config.js
- /home/stefan/playground/parcel-issue/node_modules/parcel/src/transforms/babel/transform.js
- /home/stefan/playground/parcel-issue/node_modules/parcel/src/assets/JSAsset.js
- /home/stefan/playground/parcel-issue/node_modules/parcel/src/Parser.js
- /home/stefan/playground/parcel-issue/node_modules/parcel/src/Bundler.js
- /home/stefan/playground/parcel-issue/node_modules/parcel/index.js
- /home/stefan/playground/parcel-issue/node_modules/parcel/src/cli.js
- /home/stefan/playground/parcel-issue/node_modules/parcel/bin/cli.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
    at Function.Module._load (internal/modules/cjs/loader.js:687:27)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (/home/stefan/playground/parcel-issue/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at Object.<anonymous> (/home/stefan/playground/parcel-issue/node_modules/core-js-compat/helpers.js:3:14)
    at Module._compile (/home/stefan/playground/parcel-issue/node_modules/v8-compile-cache/v8-compile-cache.js:194:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:849:19) falling back to RawAsset
馃毃  Cannot read property 'length' of undefined
    at lineCounter (/home/stefan/playground/parcel-issue/node_modules/parcel/src/utils/lineCounter.js:3:30)
    at JSPackager.writeModule (/home/stefan/playground/parcel-issue/node_modules/parcel/src/packagers/JSPackager.js:127:60)
    at async JSPackager.addAsset (/home/stefan/playground/parcel-issue/node_modules/parcel/src/packagers/JSPackager.js:88:5)
    at async Bundle._addDeps (/home/stefan/playground/parcel-issue/node_modules/parcel/src/Bundle.js:250:5)
    at async Bundle._package (/home/stefan/playground/parcel-issue/node_modules/parcel/src/Bundle.js:219:7)
    at async Promise.all (index 0)
    at async Bundle.package (/home/stefan/playground/parcel-issue/node_modules/parcel/src/Bundle.js:202:5)
    at async Promise.all (index 1)
    at async Bundle.package (/home/stefan/playground/parcel-issue/node_modules/parcel/src/Bundle.js:202:5)
    at async Bundler.bundle (/home/stefan/playground/parcel-issue/node_modules/parcel/src/Bundler.js:325:27)

馃捇 Code Sample

https://github.com/haansn08/parcel-issue-cannot-find-module-src-data

馃實 Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | ^1.12.4 |
| Node | v12.13.0 |
| npm/Yarn | npm 6.13.1 |
| Operating System | Fedora 31 / x86_64 Linux 5.3.12-300 |

Most helpful comment

still reproduces for me

All 3 comments

Same problem here.

Edit: I encounter this error with [email protected].

Edit: core-js-compat 3.4.6 seems to be broken. npm i -D [email protected] fixed this issue for me.

still reproduces for me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Niggler picture Niggler  路  3Comments

davidnagli picture davidnagli  路  3Comments

mnn picture mnn  路  3Comments

dsky1990 picture dsky1990  路  3Comments

adamreisnz picture adamreisnz  路  3Comments