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

Transpiler downloaded unnecessarily. #1250

Closed
MicahZoltu opened this issue May 2, 2016 · 6 comments
Closed

Transpiler downloaded unnecessarily. #1250

MicahZoltu opened this issue May 2, 2016 · 6 comments

Comments

@MicahZoltu
Copy link

MicahZoltu commented May 2, 2016

I have an application that has been bundled with jspm bundle. If I look at the bundle I can see that it has transpiled all of my TypeScript code into JS and put it into the bundle.

However, my application still attempts to download the typescript transpiler, even though it never actually downloads any TypeScript.

I am not sure what Aurelia is doing to trigger this but I was unable to cause it by manually calling System.import('source/app.ts').

Repro steps

  1. mkdir test

  2. cd test

  3. npm install jspm@0.17.0-beta.14

  4. .\node_modules\.bin\jspm init

    • Quick with defaults except for transpiler TypeScript and package name foo
  5. .\node_modules\.bin\jspm install aurelia-bootstrapper

  6. add a map entry to jspm.config.js:

    • "app": "src/app.ts"
  7. Change the meta "*.js" to "*.ts" in jspm.config.js

  8. Create src/app.html with:

    <template>
      <h1>${content}</h1>
    </template>
  9. Create src/app.ts with:

    export class App {
        content: String;
    
        constructor() {
            this.content = "Hello World!";
        }
    }
  10. Create index.html with:

    <!doctype html>
    <html>
        <body aurelia-app>
            <div style="text-align: center; font-size:300%">Loading...</div>
    
            <script src="jspm_packages/system.src.js"></script>
            <script src="jspm.browser.js"></script>
            <script src="jspm.config.js"></script>
            <script src="build.js"></script>
            <script>
                System.import('aurelia-bootstrapper');
            </script>
        </body>
    </html>
  11. .\node_modules\.bin\jspm bundle src\**\*.ts

  12. npm install node-static

  13. .\node_modules\.bin\static .

@guybedford
Copy link
Member

I was able to follow the steps here but I wasn't seeing the transpiler downloaded when using the bundle. Are you sure you're not using other custom configuration that may be interfering with the bundle loading?

@MicahZoltu
Copy link
Author

I don't believe so, as I wrote up these steps I was executing them at the same time to make sure I didn't miss anything. I'll go through them again this evening after having forgotten what I was doing to see if I can reproduce it again. Are there any hidden settings that JSPM may be using that could cause this? I am seeing the same problem on my build server (AppVeyor), suggesting it isn't an environment issue.

If I can reproduce it again I'll put up a git repo with the problem as well to further help troubleshooting.

@MicahZoltu
Copy link
Author

It appears I missed a critical step in my instructions!

Add "format": "esm", to jspm.config.js the foo package like so:

SystemJS.config({
  transpiler: "plugin-typescript",
  packages: {
    "foo": {
      "format": "esm",
      ...
    }
    ...
  }
  ...
});

@MicahZoltu
Copy link
Author

Reproduction case repository: https://github.com/Zoltu/jspm-test

@guybedford
Copy link
Member

Thanks, yes this is a SystemJS bug that it is trying to treat the app.html file as an ES module. I've added a fix in 4bbfdcf here.

@guybedford
Copy link
Member

Released in 0.19.28.

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

2 participants