exports's People
exports's Issues
Export fails when file extensions are removed
I was trying to convert the example code from base
to TypeScript (renaming brand.jsx
to brand.tsx
and so on), and clean up seemingly unnecessary file extensions. For example:
import { Hello } from "./hello/hello.jsx"
to
import { Hello } from "./hello/hello"
With the other change renaming components.js
to components.ts
(also in package.json).
The code with these changes does run, but the export script fails:
Exports
[01:06:03] Initializing...
[01:06:03] Generating outputs with esbuild...
[01:06:03] Esbuild completed...
[01:06:03] Preparing package.json...
[01:06:03] Preparing types...
(node:38990) UnhandledPromiseRejectionWarning: Error: Command failed: npx tsc src/components.ts --moduleResolution Node --target ESNext --listEmittedFiles true --strict true --jsx react-jsx --jsxImportSource atomico --allowJs true --declaration true --emitDeclarationOnly true --outDir ./types --lib ESNext,DOM,DOM.Iterable
at ChildProcess.exithandler (child_process.js:319:12)
at ChildProcess.emit (events.js:376:20)
at maybeClose (internal/child_process.js:1055:16)
at Socket.<anonymous> (internal/child_process.js:441:11)
at Socket.emit (events.js:376:20)
at Pipe.<anonymous> (net.js:673:12)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:38990) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:38990) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
The default export condition must come last
When package.json is generated, the conditional exports are in the wrong order: "default" must be the last one.
The example is from https://github.com/atomicojs/hooks. Here is what is generated:
{
"exports": {
".": {
"default": "./dist/index.js",
"types": "./dist/index.d.ts"
}
}
}
Here is what is expected instead:
{
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
}
This is a problem because webpack crashes if the default doesn't come last: https://github.com/webpack/enhanced-resolve/blob/v5.15.0/lib/util/entrypoints.js#L475.
Published npm package contains node_modules
See here, when browsing the code:
https://www.npmjs.com/package/@atomico/exports?activeTab=code
The examples folders ts-1 and ts-2 contain node_modules which contains the whole typescript library 2 times. This makes the package about 130MB big!
Please ignore examples when publishing the package โ this would save us many megabytes, especially in pipelines ๐
Feature: Allow exports to use sub-folder as a name
Description
When using the --exports flag, I would like the sub-folder to name the export as opposed to the filename
For example, I have the following structure:
.
โโโ src
โโโโโ button
โโโโโโโ index.js
Currently, using the --exports flag will name one of the exports as index instead of button. It would be nice if the index.js is inside a sub-folder to be able to use that as the name so the generated exports in package.json appear as:
"exports": {
"./button": "./dist/button/index.js"
}
vs
"exports": {
"./index": "./dist/button/index.js"
}
--dest CLI option is unknown
"@atomico/exports": "^0.36.0",
Relevant documentation: link
Output
> exports src/elements/*/index.ts --dest dist/browser
file:///C:/dev/repo/cc/elements/node_modules/cac/dist/index.mjs:400
throw new CACError(`Unknown option \`${name.length > 1 ? `--${name}` : `-${name}`}\``);
^
CACError: Unknown option `--dest`
Workaround
The --dist
flag seems to control the destination path, even though the help message says that it is for "Choose a project type"
exports src/elements/*/index.ts --dist dist/browser
Rename output directory from dest to dist
A minor issue, but convention is to name the distribution directory "dist".
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.