Comments (8)
I've created minimal reproduce
https://github.com/azu/packemon-cjs-issue
from packemon.
@azu Thanks, this should fix it #136
On a side note, I suggest not using cjs/mjs in parallel as you run the risk of the dual package hazard. https://nodejs.org/api/packages.html#dual-commonjses-module-packages I suggest one or the other, preferably cjs as packemon will automatically create an mjs wrapper. https://packemon.dev/docs/features#automatic-mjs-wrappers-for-cjs-inputs
from packemon.
Published, let me know if there's still issues.
from packemon.
from packemon.
I want to treat my package as mjs package by default(type: module
) because We may need to migrate Pure ESM in the future. I think that commonjs support is optional.
In other words, I want to treat .ts
as mjs.
By contrast, index-wrapper.mjs force type: "commonjs"
. so it treat my pacakge as cjs package by default.
from packemon.
@azu How does the index-wrapper.mjs force it to CJS?
from packemon.
@milesj
Reproduce repo: https://github.com/azu/packemon-cjs-and-mjs-wrapper
Reproduce Steps:
- change
type
to"module"
manually npm run build
- packemon will change
type
to"commonjs"
Aug-01-2022.07-21-05_optimized.mp4
from packemon.
@azu The type is set based on the chosen format: https://github.com/milesj/packemon/blob/master/packages/packemon/src/Package.ts#L475 And since the format is cjs
, it sets it.
It shouldn't matter though since the wrapper will be used when importing from ESM because the import
exports is set in exports
.
from packemon.
Related Issues (20)
- Babel Error: `@babel/plugin-proposal-private-property-in-object ` explicit dependency HOT 5
- any way to add rollup plugins? HOT 2
- Sourcemaps don't seem to be generated correctly
- clean command is not working HOT 1
- "helpers" feature not removing babelHelpers HOT 2
- [Docs] Meaning of directory name colors of `npx packemon files` HOT 1
- UNLICENSED package cannot pass license validation HOT 1
- Is it possible to disable asset imports? HOT 3
- "default" is imported from external module "react" but never used in "src/file.tsx" HOT 10
- .css.ts imports not inlined in output HOT 13
- Add configuration options as parameters to `scaffold` HOT 2
- packemon 4 version is still `0.0.0-internal` HOT 4
- [4.0] Scaffold for polyrepo generates `tsconfig.build.json` but looks for `tsconfig.mjs.json` HOT 1
- [4.0] Packemon ignores tsconfig `outDir` HOT 12
- Question/Feature Request: How to replace the build step? HOT 6
- '--loadConfigs' does not load Babel plugins specified in babel.config.json HOT 8
- Types *must* be imported with `type` keyword when TS `compilerOptions.verbatimModuleSyntax` is `true`
- Declarations not included and Types not satisifed by inclusion of src (broken sourcemaps) HOT 4
- Add the `@babel/plugin-syntax-import-attributes` plugin to allow JSON imports with type assertion HOT 11
- MJS wrappers of ./cjs/subdir/*.js are incorrectly created at ./cjs/*-wrapper.mjs 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 packemon.