jsdom / tr46

An implementation of the Unicode UTS #46: Unicode IDNA Compatibility Processing.
MIT License
32 stars 14 forks source link

It is not bundled with Rollup #28

Closed aminya closed 3 years ago

aminya commented 3 years ago

tr46 is not bundled with Rollup. It seems that the generated JSON file is not imported correctly.

Here is the reproduction: https://github.com/atom-ide-community/terminal/tree/rollup-bump

npm install
npm run build
[!] Error: 'default' is not exported by node_modules\tr46\lib\mappingTable.json, imported by C:\terminal\node_modules\tr46\lib\mappingTable.json?commonjs-proxy
https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module
C:\terminal\node_modules\tr46\lib\mappingTable.json?commonjs-proxy (1:8)
1: export {default} from "C:\\terminal\\node_modules\\tr46\\lib\\mappingTable.json";
           ^
Error: 'default' is not exported by node_modules\tr46\lib\mappingTable.json, imported by C:\terminal\node_modules\tr46\lib\mappingTable.json?commonjs-proxy
    at error (C:\terminal\node_modules\rollup\dist\shared\rollup.js:5252:30)
    at Module.error (C:\terminal\node_modules\rollup\dist\shared\rollup.js:9811:16)
    at handleMissingExport (C:\terminal\node_modules\rollup\dist\shared\rollup.js:9700:28)
    at Module.getVariableForExportName (C:\terminal\node_modules\rollup\dist\shared\rollup.js:9987:24)
    at Module.traceVariable (C:\terminal\node_modules\rollup\dist\shared\rollup.js:10202:45)
    at ModuleScope.findVariable (C:\terminal\node_modules\rollup\dist\shared\rollup.js:8732:39)
    at FunctionScope.findVariable (C:\terminal\node_modules\rollup\dist\shared\rollup.js:2782:38)
    at ChildScope.findVariable (C:\terminal\node_modules\rollup\dist\shared\rollup.js:2782:38)
    at MemberExpression.bind (C:\terminal\node_modules\rollup\dist\shared\rollup.js:6436:49)
    at BinaryExpression.bind (C:\terminal\node_modules\rollup\dist\shared\rollup.js:2868:23)

npm ERR! code 1
npm ERR! path C:\terminal
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c "npm run clean && cross-env NODE_ENV=production cross-env BABEL_KEEP_MODULES=true rollup -c"

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\aminy\AppData\Roaming\npm-cache\_logs\2020-11-06T11_00_18_550Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! terminal@0.0.0 prepare: `npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the terminal@0.0.0 prepare script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\aminy\AppData\Roaming\npm-cache\_logs\2020-11-06T11_00_18_595Z-debug.log
domenic commented 3 years ago

This issue does not follow the issue template, and as such will be closed.

aminya commented 3 years ago

@domenic There are no templates: image

Follow this tutorial to learn how to make an issue template: https://joeprevite.com/github-issue-template

domenic commented 3 years ago

Sorry! I thought this was on the main jsdom repository.

Regardless, it's not clear what you're doing, besides posting a bunch of logs.

aminya commented 3 years ago

I added the reproduction steps. The issue is that this package import json files using commonjs and Rollup cannot handle it. It is worth keeping the issue open in case someone else tries to use tr46 or whatwg-url with Rollup.

Sebmaster commented 3 years ago

I think you want to include the rollup json plugin to make this work.

aminya commented 3 years ago

It is already included in rollup-plugin-atomic. But bumping rollup-common-js from v14 to v15 or v16 breaks bundling. I could not find any clue in the changelogs of the plugin. https://github.com/rollup/plugins/blob/master/packages/commonjs/CHANGELOG.md

Anyway, we were planning to move away from Rollup to Parcel because of all of Rollup issues and their ignorance with respect to the community. Parcel bundles commonjs without any hassle out of the box. I just wanted to make this issue in case someone else faces this.