An error occurred while parsing the module in ./productFlow/index.tsx at line 3, column 12. The file was processed with the following loaders: * ./node_modules/awesome-typescript-loader/dist/entry.js. It seems like an additional loader may be needed to handle the output of these loaders. | import React from 'react'; | export default props => { return ( |
| );<p>Compiled Successfully</p>
The issue arises when encountering JSX code in a .tsx file. Is at-loader not equipped to handle this? I looked for a react loader, but the examples I found were similar to my own:
const webpack = require("webpack");
const dotEnvWebpack = require("dotenv-webpack");
const path = require("path");
const webpackConfiguration = {
entry : {
productFlow : path.join(__dirname, "productFlow/index.tsx")
, registrationFlow : path.join(__dirname, 'registrationFlow/index.tsx')
}
, output : {
filename : "outputFiles/[name].output.js"
, path : path.resolve(__dirname, "")
, publicPath : '/'
}
, watch : true
, watchOptions : { aggregateTimeout : 300 }
, devtool : 'inline-source-map'
, mode : "development"
, devServer : {
port: 3000
, contentBase : path.join(__dirname, "devIndex.html")
, hot : true
, historyApiFallback : true
}
, plugins : [
new webpack.HotModuleReplacementPlugin(),
new dotEnvWebpack
]
, node : {
fs: "empty" // for dotenv to work correctly
}
, resolve : { extensions : ['.ts', '.tsx', '.js'] }
, module : {
rules : [{
test : /\.tsx?$/
, use : 'awesome-typescript-loader'
, exclude : [/node_modules/, /outputFiles/]
}]
}
, externals : {
'react' : 'React'
, 'react-dom' : 'ReactDOM'
}
};
module.exports = webpackConfiguration;