Skip to content

browser: true ignored when plugin-node-resolve 14 is used with plugin-typescript #1267

Closed

Description

@FranklinWhale

Expected Behavior

The diff returns no result

Actual Behavior

In NodeResolve14-TypeScript, TS and JS output are not the same. The outputs are the same in NodeResolve13-TypeScript.

Additional Information

This is probably caused by the use of order: "post" as part of #1245. Both plugin-typescript and plugin-typescript2 require plugin-node-resolve be run before themselves.

Activity

  1. pedrotorchio commented on Sep 28, 2022

    @pedrotorchio

    This could finally explain the issues I'm having. +1

  2. FranklinWhale commented on Oct 5, 2022

    @FranklinWhale
    Author
  3. dkuhnert commented on Oct 31, 2022

    @dkuhnert

    Same issue here. My workaround is to disable @rollup/plugin-typescript's resolveId and add .ts to @rollup/plugin-node-resolve extensions:

    import typescriptPlugin from "@rollup/plugin-typescript";
    import {nodeResolve as nodeResolvePlugin} from "@rollup/plugin-node-resolve";
    
    const typescript = {
      ...typescriptPlugin(/* ... */),
      // do not resolve anything instead leave this to `@rollup/plugin-node-resolve`!
      // see also: https://github.com/rollup/plugins/issues/1267
      resolveId: undefined,
    };
    const nodeResolve = nodeResolvePlugin({
      extensions: [".mts", ".ts", ".cts", ".mjs", ".js", ".cjs", ".json", ".node"],
      mainFields: ["browser", "module", "jsnext:main", "main"],
    });
    
    // ...
  4. stale commented on Jan 5, 2023

    @stale

    Hey folks. This issue hasn't received any traction for 60 days, so we're going to close this for housekeeping. If this is still an ongoing issue, please do consider contributing a Pull Request to resolve it. Further discussion is always welcome even with the issue closed. If anything actionable is posted in the comments, we'll consider reopening it. ⓘ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions