stomp-js / stompjs

Javascript and Typescript Stomp client for Web browsers and node.js apps
Apache License 2.0
775 stars 81 forks source link

Failed to compile #614

Open henrylee2678 opened 1 year ago

henrylee2678 commented 1 year ago

./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.,

nabaonan commented 12 months ago

same problem!

harryli8725 commented 12 months ago

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

xyz-npc commented 8 months ago

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.

narjess89 commented 7 months ago

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

narjess89 commented 7 months ago

@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 commented 7 months ago

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

narjess89 commented 6 months ago

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

xyz-npc commented 5 months ago

6.1.2 would be fine @narjess89