madyankin / madyankin/postcss-modules

Unable to use via ESM CDN like JSDelivr or JSPM

Open
#153 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.6k
Forks
88
PR merge metrics
No merged PRs in 30d

Description

On JSDelivr it fails due to hard dependency on fs

await import("https://cdn.jsdelivr.net/npm/postcss-modules/+esm")
+esm:7 Uncaught Error: Failed to bundle using Rollup v2.79.1: the file imports a not supported node.js built-in module "fs". If you believe this to be an issue with jsDelivr, and not with the package itself, please open an issue at https://github.com/jsdelivr/jsdelivr

On JSPM which doesn't mind dependency to fs and can load postcss and sass due to it it fails due to an error in loader-utils subdepenendency.

await import('https://jspm.dev/postcss-modules');

npm:generic-names@4!cjs:1     GET https://jspm.dev/npm:loader-utils@3/lib/interpolateName!cjs net::ERR_ABORTED 404
Uncaught TypeError: Failed to fetch dynamically imported module: https://jspm.dev/postcss-modules

It would be really great to have it working at least on JSPM so that there's a way to bundle css modules in the browser using ESM/ImportMaps.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the package's browser import path and its dependencies on fs and loader-utils, using the JSDelivr and JSPM failures as reproduction cases. Check whether postcss-modules can load through JSPM and ESM without the loader-utils 404 or unsupported Node built-in error; done means browser-based CSS Modules bundling works through at least JSPM.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, sass
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.