On 2019, ജൂലൈ 24 2:29:07 PM IST, Pirate Praveen <[email protected]>
wrote:
>
>
>On 2019, ജൂലൈ 24 1:34:06 PM IST, Pirate Praveen
><[email protected]> wrote:
>>
>>
>>On 2019, ജൂലൈ 24 4:22:28 AM IST, Xavier <[email protected]> wrote:
>>>Final results:
>>>
>>>0.50.0 can build until 0.53.3
>>>0.51.7 can build until 0.56.3
>>>0.56.1 can build until 0.65.2
>>>0.58.1 can build until 0.67.2
>>>0.59.1 can build until 1.12.0
>>>1.12.0 can build until 1.17.0
>>>
>>>So 6 steps needed (4 breaking changes), at least 4 to update
>>node-buble
>>>(2 little breaking changes)
>>
>>Last time we broke the loop by manually converting ES module to
>>Commonjs with a patch. We could go straight to 1.17 if we follow this
>>approach as it does not involve any build.
>>
>>https://salsa.debian.org/js-team/node-rollup/blob/4fecc91f85423688acdc6d7342fe2f15c2404599/debian/patches/cjs.diff
>>
>>Alternative approach is to use type: module in package.json and the
>>node --experimental-modules to build rollup 1.17 with itself or just
>>patch bin/rollup to add --experimental-modules in shebang line.
>>
>
>It does not work with nodejs in unstable, but with nodejs in
>experimental.
>
>$ node --experimental-modules bin/src/index.js (node:32753)
>ExperimentalWarning: The ESM module loader is experimental.
>internal/modules/esm/default_resolve.js:69 let url =
>moduleWrapResolve(specifier, parentURL);
>^
>Error: Cannot find package 'minimist' imported from
>/home/praveen/forge/node-rollup/bin/src/index.js
>at Loader.resolve [as _resolve]
>(internal/modules/esm/default_resolve.js:69:13) at
>Loader.resolve (internal/modules/esm/loader.js:70:33)
>at Loader.getModuleJob (internal/modules/esm/loader.js:143:40)
>at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:43:40)
> at link (internal/modules/esm/module_job.js:42:36)
>
>This means we will have to convert all dependencies as ES modules as
>well.
After changing import to
const minimist = module.create require('minimist');
As per https://nodejs.org/api/esm.html#esm_code_require_code
$ node --experimental-modules bin/src/index.js (node:324)
ExperimentalWarning: The ESM module loader is experimental.
internal/modules/cjs/loader.js:817
internalBinding('task_queue').triggerFatalException(
^
Error [ERR_INTERNAL_ASSERTION]: Code:
ERR_UNKNOWN_FILE_EXTENSION; The provided arguments length (2) does not match
the required ones (1). This is caused by either a bug in Node.js or
incorrect usage of Node.js internals.
Please open an issue with this stack trace at
https://github.com/nodejs/node/issues
at assert (internal/assert.js:13:11)
at getMessage (internal/errors.js:284:3)
at new NodeError (internal/errors.js:177:23)
at Loader.resolve [as _resolve]
(internal/modules/esm/default_resolve.js:101:13)
at Loader.resolve (internal/modules/esm/loader.js:70:33)
at Loader.getModuleJob (internal/modules/esm/loader.js:143:40)
at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:43:40)
at link (internal/modules/esm/module_job.js:42:36)
This is the diff to node-rollup master,
diff --git a/bin/src/index.js b/bin/src/index.js
index 8024961f..a826c72e 100644 --- a/bin/src/index.js
+++ b/bin/src/index.js @@ -1,4 +1,5 @@
-import minimist from 'minimist';
+//import minimist from 'minimist'; +const minimist =
module.createRequire('minimist');
import help from './help.md';
import { version } from '../../package.json';
import run from './run/index.js';
diff --git a/package.json b/package.json
index 7f9777b1..024c4e0a 100644
--- a/package.json
+++ b/package.json
@@ -5,6 +5,7 @@
"main": "dist/rollup.js",
"module": "dist/rollup.es.js",
"jsnext:main": "dist/rollup.es.js",
+ "type": "module",
"bin": {
"rollup": "./bin/rollup"
},
I think this would be the best approach if we can fix this error.
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
--
Pkg-javascript-devel mailing list
[email protected]
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-javascript-devel