Comments (3)
I don't get why you get such error given the import from dayjs/esm
.
Make sure to import the exact file path, do not rely on Node/other bundlers magic, the WDS doesn't do magical resolve out of the box. E.g. in your case you can try
import dayjs from "dayjs/esm/index.js";
If mermaid
is importing dayjs
and uses the CommonJS file instead of the ESM, which is often happening when libraries don't specify exports for both CommonJS and ESM, then you might try the CommonJS plugin for WDS https://modern-web.dev/guides/dev-server/using-plugins/#commonjs
from web.
Still getting same error after importing like this
import dayjs from "dayjs/esm/index.js";
I have tried wds configuration by using
import { fromRollup } from "@web/dev-server-rollup";
import rollupCommonjs from "@rollup/plugin-commonjs";
const commonjs = fromRollup(rollupCommonjs);
export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
open: "/",
appIndex: "index.html",
watch: true,
nodeResolve: true,
plugins: [
commonjs({
include: [
"/node_modules/dayjs//",
"/node_modules/@braintree/sanitize-url//",
],
}),
],
});
This is also not working, Any idea ?
from web.
Please debug it. It doesn't look like a bug on our side. If you believe it is a bug, please make a minimal reproduction and push to a repository on GitHub with simple steps to reproduce.
from web.
Related Issues (20)
- Web Test Runner with Playwright-like selectors? HOT 2
- getBoundingClientRect() gives different values on test run vs. in browser HOT 1
- Coverage not generated when we are using babel with custom browser [locally]
- Test Runner config rootPath is resolved relative to cwd, not the path of the config
- Test Runner 'manual' mode import path is not relative to rootPath
- Update @web/dev-server-esbuild dependencie esbuild to v0.21 HOT 1
- Contributing guide uses npm, GitHub actions use Yarn HOT 1
- [@web/test-runner] Tests do not finish when asserting frozen objects
- Node tests failing on Windows
- Out-of-date instruction to use run-playwright-tests HOT 1
- @web/rollup-plugin-import-meta-assets: Types not part of the exports declaration in package.json
- How can I set the browser's locale when using the Web Test Runner with Playwright?
- TypeError: URL.canParse is not a function HOT 1
- [dev-server] CVE-2024-29415: "ip SSRF improper categorization in isPublic" HOT 16
- [dev-server-core | dev-server-hmr] CVE-2024-37890: "ws affected by a DoS when handling a request with many HTTP headers" HOT 1
- [@web/dev-server-rollup] Higher version of whatwg-url HOT 1
- [@web/test-runner-browserstack] + [@web/dev-server-legacy]: issues when using BrowserStack launcher for targeting certain older devices
- wtr: fails to compile standard decorators HOT 2
- question about packages/dev-server-import-maps HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from web.