Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Dynamic imports isn't available without extra Babel plugin. Perhaps something like this https://github.com/airbnb/...
Looks kinda bad practice anyways. Any specific reason for doing it this way? You can't import JSON instead?
Btw, welcome! And good use of categories there :) -
Hi @ScriptCoded! I copied the code from https://hacksoft.io/blog/... and it makes sense to do dynamic imports in this case so...
Ctrl-C Ctrl-V
Then I wanted to upgrade from require() to import/export cause vscode is giving me this warning that I should upgrade to import/export. Using require in this return statement does not give the warning tho.
Bye I don't think I can use Babel plugins here, since this is a webpack config file. Thanks for your reply and have a nice day ahead, wherever you may be :) -
why not have 2 config files? the documentation suggest having one webpack.common.js and two other: webpack.dev.js and config.prod.js, you would use webpack merge to merge the data from the webpack.common.js with the webpack.dev.js and webpack.prod.js
have a look here:
https://webpack.js.org/guides/... -
@justarandomuser You're probably using Babel since you're writing ES6. You're using node, right?
-
@justarandomuser Then you can't be using import without Babel. It has to be transpiled
-
@ScriptCoded Okay, thanks a lot everyone! Looks like I'll stick to require() for now and use @echonox solution!
-
Gaha0326dWorking with converter is not just I tell you. Handling file conversions from PDF or images to Excel, Google Sheets, or CSV is a frequent challenge in my work, and I'm not well-versed in it. Luckily, Secure Statement Converter https://securestatementconverter.com/... comes to my rescue. Just thanks to this tool, my documents are well-organized and in order.
-
TomTy0286dOf course! I can assist with the import/export syntax if you give me the exact require statement that you want to convert.
Related Rants
Any idea how i can convert this highlighted require statement to the import/export syntax? Or is it not possible?
I have two different config files for webpack dev and prod, so i need to return the correct config file in webpack.config.js.
Thanks a million! :D
question
webpack
js