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.

Plugin lacks transpile on install

See original GitHub issue

Many modules nowadays are installed and get transpiled so that developers have no issues like ES6 support. For instance, svelte and few other packages have the following format inside package.json:

{
  "name": "svelte",
  "version": "3.38.2",
  "description": "Cybernetically enhanced web apps",
  "module": "index.mjs",
  "main": "index",

svelte-i18n:

{
  "name": "svelte-i18n",
  "version": "3.3.9",
  "main": "dist/runtime.cjs.js",
  "module": "dist/runtime.esm.js",
  "types": "types/runtime/index.d.ts",
  "bin": {
    "svelte-i18n": "dist/cli.js"
  },

svelte-toast

{
  "name": "@zerodevx/svelte-toast",
  "version": "0.3.0",
  "description": "Simple elegant toast notifications",
  "author": "Jason Lee <jason@zerodevx.com>",
  "svelte": "src/index.js",
  "module": "dist/index.mjs",
  "main": "dist/index.js",

As you can see, they provide compiled main and module versions.

I personally have problems with this specific plugin when testing with mocha. I use babel to transpile my source code, but I would like to avoid transpiling node_modules.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ItalyPaleAlecommented, Jul 10, 2021

Would changing the extension of the files from .js to .jsm help? That I may be able to do hopefully without breaking too much stuff.

I am not sure I understand your testing setup, but it seems a bit unusual (to not compile before running tests). I am not able to change how this module is distributed: there are explicit reasons why I’m publishing a source (.svelte file and .js for modules) and not compiled files.

0reactions
CatchABuscommented, Jul 10, 2021

Would changing the extension of the files from .js to .jsm help? That I may be able to do hopefully without breaking too much stuff.

I am not sure I understand your testing setup, but it seems a bit unusual (to not compile before running tests). I am not able to change how this module is distributed: there are explicit reasons why I’m publishing a source (.svelte file and .js for modules) and not compiled files.

My team have always had a testing setup for server-side node sources using grunt + mocha + nyc and wanted to use the same setup for client-side. Our discussion makes me realize that the best solution is to build client sources before testing but I also need to export a single coverage report in the case of CI since we have a monorepo that relies on it.

Please don’t bother doing any changes. I believe I need to improve my testing setup for clients. Thank you very much for responding to my question! I appreciate your help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

`failed to transpile` `tslib.es6.js` after update to `v0.30.0` - GitHub
rollup-plugin-typescript2 v0.29.0 works fine, v0.30.0 introduces this error. The setup is a bit complex because it happened as part of Rollpkg. It happens...
Read more >
JavaScript needs the compile step (on install) - Gleb Bahmutov
A: Yes, unfortunately we need to include Babel and plugins in order to transpile on the user's machine. Q: What about ES7 and...
Read more >
babel-plugin-replace-import-extension - npm
Babel plugin to replace extension of file name written in import statement and dynamic import. Installation. npm install --save-dev babel-plugin ...
Read more >
Why you should use SWC (and not Babel) - LogRocket Blog
In this post, we'll cover the basics of transpilers and we'll compare Babel and SWC based on setup, execution, and speed.
Read more >
Install and Set Up Babel for your project - Imran Sayed - Medium
This will transpile your modern JS code from src/index.js and convert to JS that ... @babel/plugin-syntax-dynamic-import webpack-cli path
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