stompjs icon indicating copy to clipboard operation
stompjs copied to clipboard

Failed to compile

Open henrylee2678 opened this issue 1 year ago • 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.,

henrylee2678 avatar Nov 08 '23 22:11 henrylee2678

same problem!

nabaonan avatar Nov 28 '23 09:11 nabaonan

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; },

harryli8725 avatar Nov 28 '23 16:11 harryli8725

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.

xyz-npc avatar Mar 02 '24 15:03 xyz-npc

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

narjess89 avatar Apr 18 '24 09:04 narjess89

@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

narjess89 avatar Apr 18 '24 10:04 narjess89

@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.

kum-deepak avatar Apr 26 '24 17:04 kum-deepak

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

narjess89 avatar May 02 '24 09:05 narjess89

6.1.2 would be fine @narjess89

xyz-npc avatar Jun 19 '24 16:06 xyz-npc