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.

Published target compatibility with webpack/rollup

See original GitHub issue

The current publishing flow uses a tsconfig.json file (the one in src) and transpiles the module imports/exports to UMD.

When trying to bundle the vscode-css-languageservice npm package alongside monaco-editor-core, webpack errors about require being used in a way that cannot be staticly parsed.

Would you consider publishing to es2015 modules as well, and linking to that entry-point from the package.json’s “module” field?

To match with other solutions online, dist folder could be something in the form: dist/umd/... dist/esm/... etc.

The “module” field is being automatically picked by webpack, rollup, and other bundlers, and does not collide with the “main” field. It is only used during bundling.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
amir-aradcommented, Jan 15, 2018

possible workaround: matt-gadd/umd-compat-loader reverts the umd wrapping.

I’ve installed umd-compat-loader using npm and added the following to my webpack configuration (in module>rules):

{
    test: /node_modules\/vscode-/,
    use: {loader: "umd-compat-loader"}
}

and it seems to be working

0reactions
akosyakovcommented, Feb 8, 2018

Repositories which also cannot be consumed with webpack:

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Bundle JavaScript With Rollup — Step-by- ...
Learn how to use Rollup as a smaller, more efficient alternative to webpack and Browserify to bundle JavaScript files in this step-by-step tutorial...
Read more >
rollup.js
Compatibility. Importing CommonJS. Rollup can import existing CommonJS modules through a plugin. Publishing ES Modules. To make sure your ES modules ...
Read more >
You may not need a bundler for your NPM library
We can use a single command, yarn publish to publish to npm ... Uses "target": "es2018" - This is does a small amount...
Read more >
Publish, ship, and install modern JavaScript for faster ...
This guide demonstrates how to publish modern packages to npm, and how to install and optimally bundle modern JavaScript packages.
Read more >
Code-splitting for libraries—bundling for npm with Rollup 1.0
Publishing monolithic bundles ... };. This instructs Rollup to start with src/main.js and bundle it together with all its dependencies into a UMD ......
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