Skip to content

code splitting broken on Windows #169

@igisev

Description

@igisev

What happens and why it is wrong

Briefly:
Code splitting is not supported now

Versions

  • typescript: 3.5.3
  • rollup: 1.20.3
  • rollup-plugin-typescript2: 0.24.0

rollup.config.js

import resolve from 'rollup-plugin-node-resolve';
import ts2 from 'rollup-plugin-typescript2';

export default {
  // NOTE: object here
  input: {
    'my-lib': 'src/main.ts',
    'my-tools': 'src/tools.ts'
  },
  output: {
    dir: 'dist',
    format: 'esm'
  },
  plugins: [
    resolve(),
    ts2()
  ]
};

tsconfig.json

{
  "compilerOptions": {
    "target": "esnext",
    "module": "esnext",
    "strict": true,
    "sourceMap": true,
    "importHelpers": true,
    "downlevelIteration": true,
    "moduleResolution": "node",
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,

    "lib": ["esnext"],
    "types": ["node"]
  },
  "include": ["src/**/*.ts"],
  "exclude": ["node_modules"]
}

files

src/tools.ts

export function myFn() {
    console.log('Hello World!');
}

src/main.ts

import { myFn } from './tools';

console.log(myFn());

plugin output

dist/my-tools.js OK

function myFn() {
    console.log('Hello World!');
}

export { myFn };

dist/my-lib.js WRONG

function myFn() {
    console.log('Hello World!');
}

console.log(myFn());

expected output

dist/my-lib.js

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

console.log(myFn());

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind: bugSomething isn't working properlypriority: blockedProgress on this is blockedproblem: staleIssue has not been responded to in some timescope: upstreamIssue in upstream dependencysolution: workaround availableThere is a workaround available for this issuetopic: OS separatorsPath normalization between OSes. Windows = '\', POSIX = '/'. Rollup resolve = native, TS = POSIX

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions