-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Error when loading modules without export using AMD and outFile options #18251
Comments
Duplicate of #18232 |
@kitsonk it is not really the same, the problem is that the |
It is the same, you are trying to load it as a module, but it is being emitted as global JavaScript, and thereby cannot be loaded as a module. Just because you are concatenating to a single file is immaterial. |
Sorry, but you did not get my point, I created a gist for this use case: https://gist.github.com/micnic/eea64a938858e9450bc6a2992cb0105c please download it as zip, unpack it, run |
I did get your point.
The console.log('A');
export let undefined; to |
@aluanhaddad depends on what the behaviour is though. Obviously |
The ts compiler defines a module as a file with at least one top-level import/export statement. a file with neither is considered a global script. these assumptions are needed to allow for correct parsing of the files, since modules are parsed in strict mode. |
ok, thanks for the explanation, I think this issue can be closed |
TypeScript Version: 2.5.2
Code
gist attached: https://gist.github.com/micnic/eea64a938858e9450bc6a2992cb0105c
Expected behavior:
It is expected that the content of the files which are imported without export statement is concatenated without being wrapped in a closure and they are not required anymore in the output file.
Actual behavior:
When running the code I get the error that the file
./a
can not be found. This happens because these files are still required in the context ofmain.ts
closure in the output file.The text was updated successfully, but these errors were encountered: