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

Linked JS files are transpiled before prepending/appending #329

Open
realfish opened this issue Mar 3, 2017 · 1 comment
Open

Linked JS files are transpiled before prepending/appending #329

realfish opened this issue Mar 3, 2017 · 1 comment

Comments

@realfish
Copy link

realfish commented Mar 3, 2017

Quick summary:

It seems that the linked JS files are transpiled (by Babel) before they are concatenated. This kind of processing may introduce errors due to Babel locally/partially transforming code snippets.

Expected behaviour:

Do JS transpiling only after all linked files are concatenated.

A sample that shows the issue:

Please check realfish/codekit3-issue329 out.

In the repo,

  • 'test/app1.js' is transpiled from 'src/_app1.js', which is the entry (master file) of 'foo.js', 'bar1.js' , and 'bar2.js'.
  • 'test/app2.js' is transpiled from 'src/_app2.js'.

The source codes without transpiling of '_app1.js' (concatenated) and '_app2.js' should be identical. After processing however, there is at least one critical difference between 'test/app1.js' and 'test/app2.js' as follows.

Notice the re-declared variable _templateObject in 'app1.js', which is introduced by some ES2015 transformations via Babel. (The re-declaration is an error.) Meanwhile in 'app2.js', the seperate _templateObject and _templateObject2 variables are the expected transformation.

@realfish
Copy link
Author

realfish commented Mar 4, 2017

Oops, may be a duplication of #136.

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

No branches or pull requests

1 participant