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

typescript plugin does not recognize typescript code #80

Closed
quentinadam opened this issue Dec 5, 2019 · 3 comments · Fixed by #84
Closed

typescript plugin does not recognize typescript code #80

quentinadam opened this issue Dec 5, 2019 · 3 comments · Fixed by #84

Comments

@quentinadam
Copy link

  • Rollup Plugin Name: plugin-typescript
  • Rollup Plugin Version: 2.0.1
  • Rollup Version: 1.27.8
  • Operating System (or Browser): Mac OS X Catalina
  • Node Version: 12.13.1

How Do We Reproduce?

I have created a minimal github repo here:

https://github.com/quentinadam/test-rollup-typescript

Compile with rollup by running npm run build or rollup -c

Expected Behavior

Should compile the typescript code into a javascript bundle.

Actual Behavior

Errors with compilation (such as Error: The keyword 'private' is reserved (Note that you need plugins to import files that are not JavaScript) which show that the typescript code is not recognized.

@shellscape
Copy link
Collaborator

Thanks for the issue and repro 🍺

I just tried your reproduction and all works as expected for me:

→ npm run build

> test-rollup-typescript@1.0.0 build /code/forks/test-rollup-typescript
> rollup -c


src/index.ts → bundle.js...
created bundle.js in 141ms

Could something on your system be interfering?

@quentinadam
Copy link
Author

Thank you for the quick reply.

I have done some further testing, and I was able to pin down more specifically why it did not work in my environment and why I does work in other environments.

I still believe that there is a bug somewhere.

It appears that a parent folder of the folder I was working from contained a parenthesis "(". The exact path I was working from was "/Users/quentinadam/Dropbox (Personal)/Projects/test-rollup-typescript".

Spaces in the path do not seem to interfere but parentheses do.

If the name of the folder is changed for example from "test-rollup-typescript" to "test-rollup-typescript(test)" the npm run build step fails with the error I described above.

The issue is 100% reproducible on a fresh Digital Ocean VPS with Ubuntu 18.04 with the following commands :

# install nodejs
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs

# clone repo
git clone https://github.com/quentinadam/test-rollup-typescript.git

cd test-rollup-typescript

# install packages
npm install

# move out of folder and change folder name to include parenthesis
cd ..
mv test-rollup-typescript "test-rollup-typescript(test)"
cd "test-rollup-typescript(test)"

# run build phase
npm run build

@NotWoods
Copy link
Member

NotWoods commented Dec 9, 2019

This seems to be caused by pluginutils' createFilter interpreting parenthesis as glob characters instead of part of the path. As a result, the typescript files aren't matched properly by the filter. I'll try to put up a PR for pluginutils later.

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

Successfully merging a pull request may close this issue.

3 participants