single-spa / single-spa-playground

A website that helps you set up single-spa
http://single-spa-playground.org
MIT License
39 stars 10 forks source link

Cannot use import statement outside a module #30

Closed Danntastico closed 4 years ago

Danntastico commented 4 years ago

I'm new using single-spa and I've been trying to put a create-single-spa react application inside my root config (also created with the CLI), I'm not doing any modification, just putting the import map taken for the playground and my app crashes!

joeldenning commented 4 years ago

I tested out a brand new create-single-spa react application in single-spa-playground. I also generated a root-config. Then I took the import map from single-spa-playground and pasted it into the root config's index.ejs file. I did not see the error you have reported here, but did see a different error. The import map from single-spa-playground was missing the imports property.

image
  <script type="systemjs-importmap">
    {
      "imports": {
        "@org/project": "//localhost:8500/org-project.js",
      }
    }
  </script>

Once I changed to that, it worked. I will submit a PR to fix it. However, this seems to be different than what you're seeing. Could you provide more detail? The error message that you have reported means that there is an import statement in your output bundle, which currently doesn't work with SystemJS.