-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
file extension issues #795
Comments
Rolled back to use Rollup v. 0.32.4 solved the issue for now. |
Maybe the problem is that you are trying to use not relative paths? |
The funny thing is that everything works as expected until v. 0.33.0. After that version I got issues. |
@TrySound I tried to revert the changes in this PR locale, and it works just fine! So the issue is with that PR. The issue is located to be in the CLI source code. This lines: https://github.com/rollup/rollup/blob/master/bin/src/runRollup.js#L1 https://github.com/rollup/rollup/blob/master/bin/src/runRollup.js#L57-L58 https://github.com/rollup/rollup/blob/master/bin/src/runRollup.js#L83 |
But this lines don't response for resolving in rollup itself. |
I was running it from cli. It worked after I changed the lines. Sounds Easiest to reproduce if you use Windows and try it out. I linked to another On Jul 26, 2016 12:06 PM, "Bogdan Chadkin" notifications@github.com wrote:
|
4 persons experience the same thing with Windows On Jul 26, 2016 2:27 PM, "Kenny Flashlight" kflash123@gmail.com wrote:
|
Looks like this issue isn't going to be fixed? For me it's an annoying issue on Windows, so I did some digging into the source code and found out why this issue occur! Note! All files except This function https://github.com/rollup/rollup/blob/master/src/utils/defaults.js#L9 is the evil one! If you do this, it will automatically add the // import
import a from './rollup';
// will search for rollup.js What if this is an TypeScript file, or CoffeScript or other file types? A error will be thrown because the file isn't found. And also sometimes I'm still forced to use the |
There are still a issue also with Rollup v. 0.33.1 on Windows when using the CLI. Crazy enough not on all Windows computers I tested it on, but a few. |
|
@TrySound It uses the function isFile() to figure out if it's an valid file or not. If not, it add the extension. |
Yep. It's fallback. I meant it does not create new one with that extension. |
It's only default behavior. |
I know, so if you import a TypeScript file like this import a from './rollup' it will start to search for |
Yep. Is that a problem for you? What is the reason to let rollup by default look for some weird ts extension? If you will look at rollup source code see we even do not use fallback for js and will remove support of it soon. |
try
|
If you try to test this on Rollup v. 0.32.4 it works just fine. Changed happened after 0.33.0. Well. If you look at the issues on the TS plugin repo you will see that this is an issue for many users. |
Well without ts plugin it shoudn't look for ts extension. So the problem with ts plugin itself. |
In my case I'm not using that plugin. But I'm trying to figure out what changed in earlier versions |
And how do you process typescript? Own realisation? |
TSC |
Can you provide some repo with repro? And we will figure out together. |
I will if I can't solve this. I will come back to this issue soon. |
Solved it for now by adding this expensive code snippet file += '.ts';
if ( isFile( file ) ) return file; But I guess Webpack, Browserify etc do this different. |
Show your resolver |
I simply let it check for TS files after JS files. But a solution to this issue could be so simply that Rollup check against the most common file extensions. If not - instead of returning null - throw an error suggestion to use a Rollup plugin. Would be better then just throw this: |
Rollup do it. For default. Throw error by yourself. This will prevent using the next resolver including default. |
NP. Others who have some issues can continue this discussion. In fact I stopped using Rollup 1 week ago, and encountered this and some other stuff again when I tried Rollup. |
For further reading: rollup/rollup-plugin-typescript#52 |
@nifgraup found this issue while converting Terser to ES modules. For example, in this file: https://github.com/terser-js/terser/blob/master/main.js I haven't checked the others but I am trying to clean up Terser code, so I made a folder |
@fabiosantoscode The only issue with rollup I found during that task was #2606, in fact I think importing by full file name is clearest. |
It seems like latest version of Rollup force the developer to add a file extension
import x from 'x.js'
and not the normal way
import x from 'x
Any reason for this? I also noticed the Rollup source does it this way.
This practise breaks a lot of things. E.g. if you working with TypeScript and first need to transpile all source code down to ES6. The transpilled source will now have '.ts' extension.
If you now try to bundle the transpilled source with Rollup you get issues because the typescript files isn't found.
There are other scenarios too like this. And in the TypeScript example there isn't an option itself to use that plugin. Way to buggy. And if you try to use that plugin, you will also notice that file extensions are required. As seen in this issue ticket: rollup/rollup-plugin-typescript#52
The text was updated successfully, but these errors were encountered: