Aurelia and webpack with both .js and .ts

If I use the cli (v1.3.1) to set up a TypeScript app, and then drop some .js files in the src directory (old code from another project) the production build fails when it hits the .js files. If I convert them to .ts, everything goes well.

Is it possible to change the default webpack configuration generated by the cli to include .js files so they also get bundled along with the typescript? If so, what do I need to do to make that happen?

1 Like

Probably in 2 places:

  • tsconfig.json: add allowJs: true to the compilerOptions
  • webpack.config.js: enusre the resolve.extensions includes ['.js'] (which it probably already does, just double check)

You can find out more about resolve.extensions on webpack doc website.

1 Like