I am working with react pdf viewer package and webpack. When running the build i get a module builded failed with syntax error at (props: RenderNextPage = () => ).
The problem is that props: is not allowing to build.
I have added @babel/preset-env and @babel/react-preset to .babelrc presets The Webpack.config file looks like this
module.exports = {
entry: './src/index.jsx',
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].[contenthash].js',
},
module: {
rules: [
{
test: /\.css$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
},
'css-loader',
],
},
{
test: /\.js(x?)$/,
exclude: /node_modules/,
use: 'babel-loader',
},
],
},
resolve: {
extensions: ['.js', '.jsx'],
},
devServer: {
static: path.join(__dirname, 'dist'),
historyApiFallback: true,
port: 8001,
},
plugins: [
new HtmlWebPackPlugin({
template: './src/index.html',
filename: './index.html',
}),
new MiniCssExtractPlugin({
filename: '[name].[contenthash].css',
ignoreOrder: false,
}),
],
};