cyclejs: Copying compiled files into root of `lib` breaks source maps
Following #694, I’m still getting errors:
Here is one of them:
WARNING in ./node_modules/@cycle/run/lib/adapt.js
(Emitted value instead of an instance of Error) Cannot find source file '../../src/adapt.ts': Error: Can't resolve '../../src/adapt.ts' in '/home/travis/build/cycle-components/www/node_modules/@cycle/run/lib'
@ ./node_modules/@cycle/dom/lib/es6/MainDOMSource.js 1:0-45
@ ./node_modules/@cycle/dom/lib/es6/index.js
@ ./src/index.ts
It surprises me that in the first line, the path ./node_modules/@cycle/run/lib/adapt.js is shown, at all. The only version of @cycle/run that I have installed is v4.0.0:
$ npm ls | grep cycle/run
│ ├── @cycle/run@4.0.0 deduped
│ ├── @cycle/run@4.0.0 deduped
│ ├── @cycle/run@4.0.0 deduped
├─┬ @cycle/run@4.0.0
In this version, the main and module fields do not point there:
"main": "lib/cjs/index.js",
"module": "lib/es6/index.js",
So, how could this even be? Yet, when I look into what is installed, I see that this file exists in the package:
$ ls -l node_modules/@cycle/run/lib
total 20
-rw-r--r-- 1 shahar shahar 207 Nov 10 11:47 adapt.d.ts
-rw-r--r-- 1 shahar shahar 722 Nov 10 11:47 adapt.js
-rw-r--r-- 1 shahar shahar 782 Nov 10 11:47 adapt.js.map
drwxr-xr-x 2 shahar shahar 4096 Nov 13 12:51 cjs
drwxr-xr-x 2 shahar shahar 4096 Nov 13 12:51 es6
So, I suppose that the existence of these files outside of cjs and es6 is an artifact on the publisher’s filesystem. #742 should help with that and while we’re at it, #743.
But even if it exists, why is it used? Ahuh:
https://github.com/cyclejs/cyclejs/blob/75a2481f4e7b95989a3a7a6eaa8c33107ff36779/dom/src/DocumentDOMSource.ts#L2 https://github.com/cyclejs/cyclejs/blob/75a2481f4e7b95989a3a7a6eaa8c33107ff36779/dom/src/MainDOMSource.ts#L4 https://github.com/cyclejs/cyclejs/blob/75a2481f4e7b95989a3a7a6eaa8c33107ff36779/dom/src/mockDOMSource.ts#L5 https://github.com/cyclejs/cyclejs/blob/75a2481f4e7b95989a3a7a6eaa8c33107ff36779/html/src/HTMLSource.ts#L2
And more. A grep for /lib/ seems helpful.
These are imports of build artifacts. We must not do this anymore, since we separated lib/cjs and lib/es6. We have two build targets. The only reason that these even currently work, seems to be because of old build artifacts.
But, if #740 is implemented, such paths would again be ok (when tooling supports this).
About this issue
- Original URL
- State: open
- Created 7 years ago
- Comments: 17 (10 by maintainers)
Commits related to this issue
- inlineSourceMap and inlineSources (fixes #744) — committed to mightyiam/cyclejs by mightyiam 7 years ago
@staltz that should not be an issue, because we changed it to be part of the global object: https://github.com/cyclejs/cyclejs/blob/master/run/src/adapt.ts#L16