Git Product home page Git Product logo

Comments (3)

bashmish avatar bashmish commented on July 4, 2024

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.

sanidayalgupta avatar sanidayalgupta commented on July 4, 2024

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.

bashmish avatar bashmish commented on July 4, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.