I am newbie with next.js and I struggle with some rather normal use case, but I failed.
I have my own js lib which is ES6, I need it convert it to babel and use in my next.js app.
How can i do this? Where in this framework can i configure babel for specific files and how to attach it?
At this moment i did it manually I put my files into /static/js/mylib.js and I attached it in my component like this:
But I would like to babel my file during the build and then use that file from /build/static folder.
How can I achieve it?
Next.js, just like the create-react-app framework has made a selection of build-scripts and compilers for you, and hidden them so you don't have to worry about this stuff. You can customise a lot of it, here's the resource for that: https://nextjs.org/docs#custom-configuration
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.