I am using React and attempting to run my application, which also includes the ampqlib
module. On the start I am receiving the error:
Module parse failed: Unexpected token (2:8)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| {
> "name": "amqplib",
| "homepage": "http://amqp-node.github.io/amqplib/",
| "main": "./channel_api.js",
My package.json
:
{
"name": "submit-playlist-test-1",
"version": "1.0.0",
"scripts": {
...
},
"license": "MIT",
"author": {
"name": "Jack Herrington",
"email": "jherr@pobox.com"
},
"devDependencies": {
...
},
"dependencies": {
"@babel/runtime": "^7.13.10",
"amqplib": "^0.10.3",
"axios": "^1.1.3",
"net": "^1.0.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"tls": "^0.0.1"
}
}
My webpack.config.js
rules:
module: {
rules: [
{
test: /\.m?js/,
type: "javascript/auto",
resolve: {
fullySpecified: false,
},
},
{
test: /\.(css|s[ac]ss)$/i,
use: ["style-loader", "css-loader", "postcss-loader"],
},
{
test: /\.(ts|tsx|js|jsx)$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
},
},
],
},
What is needed to be added to the webpack.config.js
in order to run amqplib
? Thanks in advance!
The above info should have the info