GithubHelp home page GithubHelp logo

Comments (8)

iambumblehead avatar iambumblehead commented on June 11, 2024 1

Let's use this. If problems are still there for we could completely revert things back to 2.3.3 state and publish as 2.4.0

format: context.format === 'commonjs' ? 'commonjs' : 'module',

from esmock.

iambumblehead avatar iambumblehead commented on June 11, 2024 1

for now, 2.3.5 is closer to the original 2.3.3 but still gives the 'commonjs' needed for the issue resolved by 2.3.4

// 2.3.3
format: 'module',
// 2.3.4
format: context.format,
// 2.3.5
format: context.format === 'commonjs' ? 'commonjs' : 'module',

from esmock.

tommy-mitchell avatar tommy-mitchell commented on June 11, 2024

Maybe module could be used as a fallback? e.g.

format: context.format ?? 'module',

from esmock.

koshic avatar koshic commented on June 11, 2024

Maybe module could be used as a fallback? e.g.

format: context.format ?? 'module',

Sure, it solves the issue - but not the root cause. Why do we expect anything in 'context.format'? Other loaders / Node default loader may resolve module format, may not. Only esmock has knowledge about files with urls like 'file:///Users/xxxxxxxx/packages/create-request/src/create-request.ts?esmk=1'

PS Yes, I checked my ts-loader - I don't set any format for .ts files if they are imported via relative urls inside 'resolve' hook, it's responsibility of 'load' hook (valid behaviour according to docs). Node default resolver do nothing for .ts file too. And because esmock placed into chain after ts-loader and due to 'shortCircuit: true' here

shortCircuit: true,

ts-loader just have no ability to pass proper format next (== to Node default loader).

from esmock.

iambumblehead avatar iambumblehead commented on June 11, 2024

oh no I'm sorry everyone

from esmock.

iambumblehead avatar iambumblehead commented on June 11, 2024

npm won't let me unpublish it

from esmock.

iambumblehead avatar iambumblehead commented on June 11, 2024

[email protected] is published

from esmock.

iambumblehead avatar iambumblehead commented on June 11, 2024

@koshic I agree with your comments and am interested to try removing "format" altogether. I don't remember why it is used and it could be something that was used for node 12 or node 14 which esmock did support but there was a problem with npm that forced us to drop node 14 from the test matrix

from esmock.

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.