Skip to content

[Bug]: @rollup/plugin-node-resolve incorrectly parses module paths during bundling #1890

@Hoshino-Yumetsuki

Description

@Hoshino-Yumetsuki

@rollup/plugin-node-resolve incorrectly parses module paths during bundling, resulting in malformed import paths in the output JavaScript file.

It will generate the import with the path of the node_modules like

import { h as e } from "E:ProjectsRMPR\node_moduleskoishilibindex.mjs";
e(``);
var t = e;
export { t as default };

minimal reproduce

import { h } from 'koishi'
h('')
export default h
}

main().catch(error => console.error('Error in main function:', error))
import resolve from '@rollup/plugin-node-resolve'

export default {
  input: 'src/main.ts',
  output: {
    file: 'dist/main.js',
    minify: true
  },
  external: [/node_modules/],
  platform: 'node',
  plugins: [resolve()]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions