Closed azu closed 3 years ago
babel-plugin-transform-import-to-skypack-cdn just ignore the version of scoped modules.
For example, @textlint/kernel will be resolved as @textlint/kernel@3.3.2. But, babel-plugin-transform-import-to-skypack-cdn ignore the version.
@textlint/kernel
@textlint/kernel@3.3.2
require("isomorphic-unfetch"); const fs = require("fs"); const path = require("path"); const { compile } = require("uniroll"); const files = { "/package.json": `{ "dependencies": { "@textlint/kernel": "3.3.2", "@textlint/textlint-plugin-markdown": "5.1.12", "textlint-rule-no-todo": "2.0.1" } }`, "/index.js": ` import { TextlintKernel } from "@textlint/kernel"; import markdown from "@textlint/textlint-plugin-markdown"; import rule from "textlint-rule-no-todo"; const textlint = new TextlintKernel(); textlint.lintText("- [ ] No TODO ", { filePath: "/path/to/README.md", ext: ".md", plugins: [ { pluginId: "markdown", plugin: markdown } ], rules: [{ ruleId: "textlint-rule-no-todo", rule: rule, options: {} }] }).then(result => { console.log("Output:"); console.log(JSON.stringify(result, null, 4)); }).catch(error => { console.error(error); }); ` }; (async () => { const bundle = await compile({ useInMemory: true, files, input: "/index.js" }); // return rollup object const out = await bundle.generate({}); for (const i of out.output) { if (i.type === "chunk") { const outpath = path.join(process.cwd(), "out.js"); fs.writeFileSync(outpath, i.code); } } })();
This issue is caused by this line.
https://github.com/mizchi/uniroll/blob/d17c73bfc4a49677df21ca3c7d1768e356652f6b/packages/babel-plugin-transform-import-to-skypack-cdn/src/index.ts#L42 https://github.com/mizchi/uniroll/blob/d17c73bfc4a49677df21ca3c7d1768e356652f6b/packages/babel-plugin-transform-import-to-skypack-cdn/src/index.ts#L62
The scoped module includes / and the libraryName is wrong on the scoped module.
/
libraryName
I removed this plugin. Now it works on rollup-plugin-http-resolve.
babel-plugin-transform-import-to-skypack-cdn just ignore the version of scoped modules.
For example,
@textlint/kernel
will be resolved as@textlint/kernel@3.3.2
. But, babel-plugin-transform-import-to-skypack-cdn ignore the version.This issue is caused by this line.
https://github.com/mizchi/uniroll/blob/d17c73bfc4a49677df21ca3c7d1768e356652f6b/packages/babel-plugin-transform-import-to-skypack-cdn/src/index.ts#L42 https://github.com/mizchi/uniroll/blob/d17c73bfc4a49677df21ca3c7d1768e356652f6b/packages/babel-plugin-transform-import-to-skypack-cdn/src/index.ts#L62
The scoped module includes
/
and thelibraryName
is wrong on the scoped module.