parcel: Parcel with source maps enabled cannot import LiveScript
π bug report
Parcel with source maps enabled cannot import LiveScript
π Configuration (.babelrc, package.json, cli command)
{
"name": "livescript-parcel",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "parcel build index.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"livescript": "^1.6.0",
"parcel-bundler": "^1.10.3"
}
}
π€ Expected Behavior
import livescript from 'livescript' should work
π― Current Behavior
> parcel build index.js
β οΈ Could not load existing sourcemap of "node_modules/livescript/lib/index.js".
π¨ livescript-parcel/node_modules/livescript/lib/index.js:69:43: Expecting Unicode escape sequence \uXXXX (69:43)
67 | if ((ref$ = options.map) === 'linked' || ref$ === 'debug') {
68 | mapPath = path.basename(outputFilename) + ".map";
> 69 | result.code += "\n + mapPath + "\n";
| ^
70 | } else {
71 | result.code += "\n//# sourceMappingURL=data:application/json;base64," + bufferFrom(result.map.toString()).toString('base64') + "\n";
72 | }
It appears that parcel is incorrectly interpreting the file as a source map.
if ((ref$ = options.map) === 'linked' || ref$ === 'debug') {
mapPath = path.basename(outputFilename) + ".map";
result.code += "\n//# sourceMappingURL=" + mapPath + "\n";
} else {
result.code += "\n//# sourceMappingURL=data:application/json;base64," + bufferFrom(result.map.toString()).toString('base64') + "\n";
}
π» Code Sample
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 5
- Comments: 23 (8 by maintainers)
Commits related to this issue
- fix sourcemap parsing https://github.com/parcel-bundler/parcel/issues/2408 — committed to dbecherdialpad/parcel by dbecherdialpad 4 years ago
- Disable source map to prevent build errors https://github.com/parcel-bundler/parcel/issues/2408 — committed to nusmodifications/nusbusiness by ZhangYiJiang 5 years ago
- frontend: switch to parcel v2 As always frontend dev is convoluted. parcel v1 doesn't play nicely with vue: https://github.com/parcel-bundler/parcel/issues/2408 so we would need to disable source map... — committed to Bayer-Group/pavo by ap-- 3 years ago
Two fixes :
\nfrom strings in the package sources (node_modules/paper/dist/paper-full.jsin my case)parcel index.html --no-source-mapsIs there a better solution?
This is still an issue with 1.x.
iβm sorry to say @DeMoorJasper but this is not fixed in 1.x versions. adding the
--no-source-mapsis a hack not a proper way to use it. can you please provide the PR or commit it for this fix?Same issue with paper.js:
Ran into this issue with an imported React component that was bundled with webpack. Especially unfortunate because I had to use webpack to bundle that component in the first place because of https://github.com/parcel-bundler/parcel/issues/3305 On the plus side, the
--no-source-mapsis an acceptable workaround for me.(I frigging love Parcel btw, I wish I could use it all the time for everything!)
Can we get a release cut with this fix before 2.0? We arenβt able to compile with source maps which is making debugging difficult. Iβd like to avoid forking and cherry-picking the fix
This just bit me when importing
vuejs-datepickerinto my project. A temporary workaround was to use parcel with--no-source-maps, but Iβm looking forward to the proper solution.I guess the source map detection should check if itβs at the end of the file (as in: there are no non-whitespace characters after the comment)
https://github.com/parcel-bundler/parcel/blob/060db2e2c56f08e223e9a9075035f0998e249763/packages/core/parcel-bundler/src/assets/JSAsset.js#L26
https://github.com/parcel-bundler/parcel/blob/060db2e2c56f08e223e9a9075035f0998e249763/packages/core/parcel-bundler/src/assets/JSAsset.js#L85-L91
@DeMoorJasper I think Iβve encountered the same problem. Update to Parcel 2 worked for me. The code sample (https://github.com/raine/livescript-parcel) runs for me without build errors, when I use Parcel 2.
π Bug Report
Parcel with source maps enabled cannot import ckeditor5 Editor
π Configuration (.babelrc, package.json, cli command)
π€ Expected Behavior
import ClassicEditor from '@ckeditor/ckeditor5-build-classic'should workπ― Current Behavior
π Possible Solution
Use Parcel 2
π Environment
@medmin does it work in Parcel 2?
I think we fixed this.
Same issue with TypeScript.
The line in dependency:
have transformed to
Part of the string and the quote was cut