stomp-js/stompjs

Failed to compile

henrylee2678 opened this issue · 8 comments

./node_modules/@stomp/stompjs/bundles/stomp.umd.js 501:24
Module parse failed: Unexpected token (501:24)
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
| };
| this.close();

        origOnClose?.call(webSocket, {

| code: 4001,
| reason: Quick discarding socket (#${id}) without waiting for the shutdown sequence.,

same problem!

try to add this configuration in your webpack.config file
configure: (webpackConfig, { env, paths }) => { webpackConfig.module.rules.push({ test: /node_modules\/@stomp\/stompjs\/.*\.js$/, use: { loader: 'babel-loader', options: { presets: ['@babel/preset-env'], plugins: ['@babel/plugin-proposal-optional-chaining'], }, }, }); return webpackConfig; },

I encountered a similar issue recently. After investigating, I realized that it was related to the node version.
If you’re using Node.js 16 or below, consider switching to a lower version of the package. This may resolve the issue.

How did you fix the issue please? The node version I am using is 14, but I got the error

@kum-deepak , can you please help me to resolve the issue ? I Want to use @stomp/stomp.js 7.0.0 with angular 9 and node 14 ? I had the described error when compiling the project.
Thank you for help

@kum-deepak , can you please help me to resolve the issue ? I Want to use @stomp/stomp.js 7.0.0 with angular 9 and node 14 ? I had the described error when compiling the project. Thank you for help

Please follow the tutorial at https://stomp-js.github.io/guide/rx-stomp/rx-stomp-with-angular.html

Do not use the latest rx-stomp, instead use 1.2.0.

Hello @kum-deepak ,
Tank you for your response, Actually I am using @stomp/stomp.js and not @rx-stomp, so what version you recommand me to use for stomp/stomp.js ?
Thank you

6.1.2 would be fine @narjess89