Comments (6)
I will give it a try, but can I ask if the project compiles without immutable
?
I will reproduce the bug and see what can it be done. I did test 9.2.0 with TS and it worked. Still, your issue helped me to find that Rambdax has issues regarding latest changes, so in any case, I want to thank you for opening it.
from rambda.
I will give it a try, but can I ask if the project compiles without
immutable
?I will reproduce the bug and see what can it be done. I did test 9.2.0 with TS and it worked. Still, your issue helped me to find that Rambdax has issues regarding latest changes, so in any case, I want to thank you for opening it.
Oh,I want to build my project as a lib but not app, so I use rollup-plugin-node-externals
to exclude all dependencies.
The full rollup.config.js
import path from "node:path";
import url from "node:url";
import commonjs from "@rollup/plugin-commonjs";
import json from "@rollup/plugin-json";
import nodeResolve from "@rollup/plugin-node-resolve";
import fs from "fs-extra";
import json5 from "json5";
import clear from "rollup-plugin-clear";
import externals from "rollup-plugin-node-externals";
import typescript from "rollup-plugin-typescript2";
const __filename = url.fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const resolve = p => path.resolve(__dirname, p);
const packageJSONPath = resolve("package.json");
const tsconfigJSONPath = resolve("tsconfig.json");
const packageJson = json5.parse(fs.readFileSync(packageJSONPath).toString());
const tsconfigJson = json5.parse(fs.readFileSync(tsconfigJSONPath).toString());
const {
outDir: outputDirectory
} = tsconfigJson["compilerOptions"];
export default {
input: "src/index.ts",
output: {
dir: "./dist",
format: "es",
exports: "named",
preserveModules: true,
},
plugins: [
clear({
targets: ["./dist"],
}),
json(),
nodeResolve({
preferBuiltins: false,
}),
commonjs(),
typescript({
tsconfigJson,
}),
externals(),
],
};
The output structure is following
dist
`-- index.js
0 directories, 1 file
and the output index.js
only container my project code without Rambda
The above issue is reproduce in this way.
extra problem
I also test not using rollup-plugin-node-externals
as rollup plugins, and the output dir structure is
dist
|-- _virtual
| `-- rambda.js
|-- node_modules
| `-- rambda
| |-- dist
| | `-- rambda.js
| `-- immutable.js
`-- src
`-- index.js
5 directories, 4 files
However,in this cas,execute node ./dist/src/index.js
will occur
import { i as immutable } from '../node_modules/rambda/immutable.js';
^
SyntaxError: Named export 'i' not found. The requested module '../node_modules/rambda/immutable.js' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from '../node_modules/rambda/immutable.js';
const { i: immutable } = pkg;
at ModuleJob._instantiate (node:internal/modules/esm/module_job:132:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:214:5)
at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
at async loadESM (node:internal/process/esm_loader:28:7)
at async handleMainPromise (node:internal/modules/run_main:113:12)
Node.js v20.11.0
But I check the bundled rambda/immutable.js file, which is
import './dist/rambda.js';
import { __exports as rambda } from '../../_virtual/rambda.js';
var immutable = rambda;
export { immutable as i };
And obviously it has exported i
。
from rambda.
I spent some time exploring options of using exports
object in package.json
vs using main
property and I found that using main
is causing less trouble, so I don't think that I will change that. Still, when I have time, I will check what is the root cause for your case.
Just one question - what happens if you don't use immutable
as I think this is important to know?
from rambda.
I import rambda by rambda/immutable
to use readonly
type declaration for typescript.
Or do you have some way to use readonly
type declaration when coding and compiling without immutable
from rambda.
I mean, is the issue happens if you simply import rambda
not rambda/immutable
? This will be helpful when debugging.
from rambda.
I am closing this as I needed the last feedback. Feel free to reopen it with answer to it.
from rambda.
Related Issues (20)
- Type error for dissocPath - error TS2554: Expected 1 arguments, but got 2 HOT 3
- sortWith is missing in 8.6.0 HOT 2
- Missing release tag v8.6.0 HOT 1
- Add `reduceBy` HOT 2
- Looking for more core contributers/owners for this project HOT 6
- Composition of Lenses do not type properly HOT 8
- [BUG] - Upgrade to rambda 9 HOT 1
- Hijack Question for code-complexity: Add cognitive complexity as well HOT 1
- Rambda 9 release? HOT 3
- [BUG] R.cond transform is unary HOT 1
- [BUG] Behavior of rambda isEmpty() deviates from ramda's isEmpty() function HOT 2
- [BUG] Remove the SRC and Readme from dist folder HOT 3
- R.once TS type definition miss to context argument and its type HOT 4
- [BUG] the deno instructions don't work HOT 2
- Restore CONTRIBUTING.md file
- Add `memoizeWith` HOT 5
- Links in README.md not found HOT 1
- [BUG] `isEmpty` not checking for nullish values HOT 2
- [Feature] Allow Different Ouput Types for Set, Over, Etc 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 rambda.