Code Monkey home page Code Monkey logo

Comments (7)

milesj avatar milesj commented on June 5, 2024

This is an interesting one, since I force it to always use import() unless on the legacy support. https://github.com/milesj/packemon/blob/master/packages/packemon/src/babel/config.ts#L9

Is this using babel or swc?

Will dig into.

from packemon.

azu avatar azu commented on June 5, 2024

Probably, it uses babel? (It will use default transpiler)
However, I've tried to run PACKEMON_SWC=true npm run build and I get similar output.

https://github.com/azu/packemon-native-dynamic-import/blob/swc/cjs/index.cjs

from packemon.

milesj avatar milesj commented on June 5, 2024

This is confusing. This is the line in Babel where the call gets transformed: https://github.com/babel/babel/blob/main/packages/babel-plugin-transform-modules-commonjs/src/index.ts#L184

Yet when I debug and log, this line is never called, YET the imports are still being transformed. Either this is a bug in Babel, or something else is going on that I'm not aware of.

from packemon.

milesj avatar milesj commented on June 5, 2024

The REPL seems to transform it also. https://babeljs.io/repl#?browsers=node%2016&build=&builtIns=false&corejs=3.6&spec=false&loose=false&code_lz=JYWwDg9gTgLgFAcgGYQgglEA&debug=false&forceAllTransforms=false&shippedProposals=true&circleciRepo=&evaluate=true&fileSize=false&timeTravel=false&sourceType=module&lineWrap=true&presets=env%2Ctypescript&prettier=false&targets=Node-16&version=7.18.9&externalPlugins=&assumptions=%7B%7D

from packemon.

milesj avatar milesj commented on June 5, 2024

Turns out, it's rollup causing this. Digging into further.

from packemon.

milesj avatar milesj commented on June 5, 2024

This'll fix it: #139

Thanks for the report.

from packemon.

azu avatar azu commented on June 5, 2024

Thanks!

from packemon.

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.