Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[@rollup/plugin-typescript] Doesn't parse packages outside root dir, monorepo packages #1520

Closed
taylorfsteele opened this issue Jun 12, 2023 · 0 comments · Fixed by #1521
Closed

Comments

@taylorfsteele
Copy link

taylorfsteele commented Jun 12, 2023

Rollup Version

3.25.1

Operating System (or Browser)

Browser

Node Version (if applicable)

16.14.2

Link To Reproduction

https://stackblitz.com/edit/stackblitz-starters-tyztyr?file=packages%2Fmy-package-with-rollup%2Frollup.config.mjs

Reproduction Steps

  1. Open https://stackblitz.com/edit/stackblitz-starters-tyztyr?file=packages%2Fmy-package-with-rollup%2Frollup.config.mjs
  2. Run cd packages/my-package-with-rollup/
  3. Run npm run build

Expected Behaviour

Using the @rollup/plugin-typescript plugin in conjunction with the @rollup/plugin-node-resolve plugin should allow rollup to parse TypeScript in files outside the main directory:

// rollup.config.mjs
import nodeResolve from '@rollup/plugin-node-resolve';
import typescript from '@rollup/plugin-typescript';

export default {
  input: ['index.ts'],
  output: {
    file: 'bundle.js',
    format: 'esm',
  },
  plugins: [nodeResolve(), typescript()],
};

// package.json
...
 "dependencies": {
    "my-workspace-package": "workspace:^"
  }

Actual Behaviour

Rollup errors: [!] RollupError: Unexpected token (Note that you need plugins to import files that are not JavaScript).

Including outside files in the include pattern does nothing as well:

typescript({ include: ['index.ts', '../my-workspace-package/index.ts'] }),

The filterRoot set to false also doesn't fix it, which I would expect it to based on the docs:

typescript({ filterRoot: flase })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant