I am trying to import a module called Auth.js in my React&Typescript component called main.tsx. Part of my webpack.config is :
module.exports = {
entry: entries,
output: output,
devtool: devtool,
resolve: { extensions: ['.ts','.js','.tsx','.css'] },
module: {
rules: [
{
test:/\.tsx?$/,
exclude:/node_modules/,
use:[{ loader:'ts-loader'}]
},
{
test:/\.css$/,
exclude:/node_modules/,
include:[path.resolve(__dirname,"src")],
use:[
{ loader:'style-loader'},
{ loader:'typings-for-css-modules-loader', options:{ modules:true,namedExport:true,camelCase:true } }
]
}
]
},
plugins: plugins
};
When I run webpack I get this error:
ERROR in ./src/containers/main.tsx
(14,23): error TS6143: Module '../Auth/Auth' was resolved to '/Users/me/src/Auth/Auth.js', but '--allowJs' is not set.
ERROR in ./src/Auth/Auth.js
Module parse failed: /Users/me/src/Auth/Auth.js Unexpected token (6:8)
You may need an appropriate loader to handle this file type.
What do I need to specify in the config to handle the Auth.js file in my application?
UPDATE: I applied the suggestion and the resolved the allowJs issue. However the second error message, which would be a webpack error I suspect is not resolved. So how can I update the webpack configuration so it will allow for .js files to be loaded?