aurelia / bundler

A library for bundling JavaScript, HTML and CSS for use with SystemJS.
MIT License
37 stars 25 forks source link

Bundle JSX #175

Closed Mobe91 closed 4 years ago

Mobe91 commented 4 years ago

Does the bundler support bundling JSX and if yes, how?

The following does not work:

bundles": {
    "dist/app-build": {
      "includes": [
        "[**/*.jsx]"
      ]
    }
}

JSX files are not included in the bundle.

Using the text-plugin, I can get the files to be included in the bundle and also the file pointers are included in config.js. But then, SystemJS loads the files directly instead from the bundle.

bundles": {
    "dist/app-build": {
      "includes": [
        "[**/*.jsx!text]"
      ]
    }
}
3cp commented 4 years ago

Fyi, this bundler is largely out of maintenance as far as I know.

Mobe91 commented 4 years ago

What should be used instead?

3cp commented 4 years ago

Aurelia cli has an option of builtin bundler if you don't want to use webpack.

For jsx support (you must have an interesting hybrid app), you can turn on babel plugin for jsx support, or typescript compiler option for jsx if you are using typescript.

3cp commented 4 years ago

If you just want to bundle jsx file as text module, without transpiling, webpack has raw-loader, also cli built-in bundler has option to add file extension to text plugin. You can go though their doc first.

Mobe91 commented 4 years ago

Thanks for the pointers. I managed to use Babel within my JSPM/Typescript build to transpile JSX and bundle the resulting JS.