Ok, so I got Snowpack to work with Meteor React app…
Here is the config I’ve used:
"snowpack": {
"aliases": {
"meteor/mongo": "meteor_stubs"
},
"extends": "@snowpack/app-scripts-react",
"scripts": {
"mount:imports": "mount imports --to /imports",
"mount:meteor_stubs": "mount meteor_stubs --to /meteor_stubs",
"build:js,jsx": "@snowpack/plugin-babel"
},
"installOptions": {
"alias": {
"meteor/meteor": "meteor_stubs",
"meteor/accounts-base": "./meteor_stubs/account_base.js",
"meteor/random": "./meteor_stubs/random.js",
"meteor/dburles:factory": "./meteor_stubs/dburles_factory.js",
"meteor/edgee:slingshot": "./meteor_stubs/edgee_slingshot.js",
"meteor/reactive-var": "./meteor_stubs/reactive_var.js",
"meteor/react-meteor-data": "./meteor_stubs/react_meteor_data.js",
"meteor/mongo": "meteor_stubs",
"meteor/http": "./meteor_stubs/meteor_http.js",
"meteor/check": "./meteor_stubs/meteor_check.js",
"meteor/tracker": "./meteor_stubs/tracker.js",
"meteor/ultimatejs:tracker-react": "./meteor_stubs/tracker_react.js",
"meteor/mdg:validated-method": "./meteor_stubs/validated_method.js",
"meteor/universe:i18n": "./meteor_stubs/universe_i18n.js",
"meteor/alanning:roles": "./meteor_stubs/alanning_roles.js",
"meteor/chuangbo:cookie": "./meteor_stubs/chuangbo_cookie.js"
}
},
"plugins": [
"@snowpack/plugin-babel"
]
},
I created a local NPM package to stub the meteor client, I’ll try to publish it when I’ve time.
But basically, this approach works minus the SSR, so I think we can forget about webpack for good, and keep Meteor build for production and backend during dev since it has unique features such as differential bundling and I think tree shaking is coming soon as well, thus making it superior to webpack in production and when coupled with things like snowpack in development. Anyway I was never a fan of webpack to start with, but it had the right approach with the assets dependency graph and it gets credit for that.
Let me know if you’ve any thoughts or comments.