Skip to content

Code splitting doesn't work when plugins resolve imports in POXIS format on windows #3094

@ezolenko

Description

@ezolenko
  • Rollup Version: 1.20.3
  • Operating System (or Browser): Windows
  • Node Version: v8.11.1

How Do We Reproduce?

Unpack attached example code, run npm install, run
.\node_modules\.bin\rollup -c .\rollup.config.js

See also: ezolenko/rollup-plugin-typescript2#169

Expected Behavior

my-lib.js bundle should look like this:

import { myFn } from './my-tools.js';

console.log(myFn());

Actual Behavior

Contents of my-tools.js gets bundled in.

Reason

Rollup seems to be using resolved import paths as keys without normalizing them, rollup-plugin-typescript2 uses typescript's resolver and returns POXIS path, whatever rollup uses returns Windows paths, so strings are different.

There is an option for rollup-plugin-typescript2 (rollupCommonJSResolveHack: true) to run resolved import through resolve() to get native OS path before returning it to rollup, using that produces correct bundles.

Ideally rollup should just normalize import paths somewhere.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions