I am new to Snowpack (and frontend build tools in general), but I am looking for a solution to use my Node modules inside my client-side Javascript (using ESM syntax), and the idea of Snowpack bundling my modules in separate JS-files attracts me. This is my file structure:
/node_modules
/assets
/css
/js
/img
/lib
/views
*.config.js
package.json
I am interested in Snowpacks ability to build only my Node modules that I personally installed (what's inside my package.json) for use in the browser, and leave the rest of my application alone. I want Snowpack to put my files in the /assets/lib directory, but any configuration I try, it just doesn't work out. Snowpack takes my entire project folder, builds any module it finds, and puts it all inside my /assets/lib directory. With my limited knowledge of Snowpacks configuration, I've created this as my snowpack.config.js file:
module.exports = {
buildOptions: {
out: './assets/lib',
baseUrl: './'
},
};
If anyone with a little more experience in Snowpack than me could help me out with what I'm doing wrong here, it would be greatly appreciated!
If you set the root folder in snowpack.config.js it will only build the contents of that folder to the out folder specified in buildOptions.