You are viewing a single comment's thread from:

RE: Introducing: dhive-sl

in HiveDevs2 years ago

Tree-shaking is amazing. I tried making the switch to dhive-sl in my Nuxt-JS project but I'm stuck on this webpack build error. Any suggestions?

Some StackOverflow threads recommended upgrading webpack, and I tried that without success.

ERROR in ./node_modules/dhive-sl/dist/dhive-sl.esm.js 1:2936 Module parse failed: Unexpected token (1:2936) 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

Sort:  

Hey, a solution is to add the following code to your nuxt config

build: {
  transpile: [
    ...
    'dhive-sl',
  ],
}

Thank you so much, it worked! The bundle size decreased by 186KB.

And the Nuxt analyzer shows a side-by-side comparison of dhive.js vs dhive-sl.esm.js.

9F36EE75-09F3-4C11-A50A-5DBEDDD873AC.png

Nice!

Note that dhive bundled all of the dependencies and native code into a single js file, while dhive-sl doesn't, thus dependencies that dhive-sl relies on aren't included in dhive-sl.esm.js. But those summed up should still be much smaller than previous dhive.js file.