Web builds should polyfill node libraries
See original GitHub issueCurrently building a nodejs project that the path module:
The web output (esm/web.js
) currently has this import:
...
// Generated with Packemon: https://packemon.dev
// Platform: browser, Support: current, Format: esm
import { relative, dirname, join, posix, resolve, basename, isAbsolute } from 'path';
...
This first of all breaks parsing as browsers do not like non relative import paths (Uncaught TypeError: Failed to resolve module specifier "path". Relative references must start with either "/", "./", or "../"
)
It also is not a valid import as the path
module library is not available in browsers. It would great if it could “polyfill” / “shim” the path
module similar to webpack for web builds
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
How to polyfill node core modules in webpack 5 - Alchemy
In this tutorial, you'll learn how to polyfill node core modules in webpack version 5 and above using the react-app-rewired package, ...
Read more >How to Polyfill node core modules in webpack 5
Install the needed pollyfills.(do an initial build of your application and it will tell you.) Modify node_modules/react-scripts/config/webpack.
Read more >v5 used to include polyfills for node.js core modules by default
Package maintainers should ideally build node or browser specific bundles. Again this is my personal view I support the move in Webpack, ...
Read more >How to polyfill node core modules in webpack - DevDojo
In this tutorial you will learn how to polyfill node core modules in ... gain access to tools that will help you build...
Read more >Polyfilling a JavaScript library the right way | by Lee Cheneler
I recently wrote a post about polyfilling a web app (which you can read here) and ... you should always polyfill JavaScript libraries...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This would solve the problem and support more than
path
. However, need to wait for an official release. https://github.com/snowpackjs/rollup-plugin-polyfill-nodeAwesome, glad to hear!