question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Parcel with source maps enabled cannot import LiveScript

See original GitHub issue

🐛 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

https://github.com/raine/livescript-parcel

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:23 (8 by maintainers)

github_iconTop GitHub Comments

10reactions
arthurswcommented, Mar 21, 2020

Two fixes :

  • either remove \n from strings in the package sources (node_modules/paper/dist/paper-full.js in my case)
  • or disable source-maps: parcel index.html --no-source-maps

Is there a better solution?

9reactions
Maker-Markcommented, Jun 23, 2021

This is still an issue with 1.x.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Source Maps - Parcel
Below is an example covering all ways of adding mappings to a SourceMap instance: import SourceMap from '@parcel/source-map'; let sourcemap = new SourceMap( ......
Read more >
Source Maps - Rollbar Docs
Benefits of providing your source maps to Rollbar include: Stack traces ... Source maps are automatically enabled in your project, but you still...
Read more >
source-map-support - npm
Start using source-map-support in your project by running `npm i ... Instead of: import sourceMapSupport from 'source-map-support' ...
Read more >
Use a source map — Firefox Source Docs documentation
The JavaScript sources executed by the browser are often transformed in some way from the ... To enable the debugger to work with...
Read more >
source-map-loader - webpack
Disclaimer: source-map-loader is a third-party package maintained by community members, it potentially does not have the same support, security policy or ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found