Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ Meteor v3 ] - Add support to Meteor3? #81

Closed
Grubba27 opened this issue Jan 8, 2024 · 9 comments · Fixed by #96
Closed

[ Meteor v3 ] - Add support to Meteor3? #81

Grubba27 opened this issue Jan 8, 2024 · 9 comments · Fixed by #96

Comments

@Grubba27
Copy link

Grubba27 commented Jan 8, 2024

I was trying to make Vite, Meteor, and Angular work, and I found that it will not be possible in the 2.x version, due to an error with Node versions. (Maybe create an issue for making Meteor-vite with Angular?)

Currently, if you try using meteor-vite with Meteor 3 it gives this error:
Screenshot 2024-01-08 at 12 06 34

I tried publishing it just changing the package versions to be aware of Meteor 3 but it did not worked so well, this is my package.js:

Package.describe({
  name: 'grubba:vite-bundler-to-beta',
  version: '1.10.1-beta300.0',
  summary: 'Integrate the Vite.js bundler with Meteor',
  git: 'https://github.com/JorgenVatle/meteor-vite',
  documentation: 'README.md',
})

Package.registerBuildPlugin({
  name: 'vite',
  use: [
    'ecmascript@0.16.2 || 1.0.0 || 0.16.8-alpha300.19',
    'caching-compiler@1.2.2 || 2.0.0-beta300.0',
    'babel-compiler@7.9.0',
    'typescript@3.0.0 || 4.0.0 || 5.0.0 || 4.9.5-alpha300.19',
  ],
  sources: [
    'build.js',
    'workers.ts',
  ],
  npmDependencies: {
    execa: '6.1.0',
    'fs-extra': '10.1.0',
    'picocolors': '1.0.0',
  },
})

Npm.depends({
  'picocolors': '1.0.0',
});

Package.onUse(function(api) {
  api.versionsFrom(['1.8', '2.3', '2.12', '3.0-beta.0']);
  api.use([
      'fetch',
      'webapp',
      'typescript@3.0.0 || 4.0.0 || 5.0.0 || 4.9.5-alpha300.19',
      'isobuild:compiler-plugin@1.0.0',
  ]);
  api.use([
      'zodern:types@1.0.9',
  ], {
      weak: true,
  })
  api.addAssets(['loading/dev-server-splash.html'], 'server');
  api.mainModule('client.ts', 'client');
  api.mainModule('vite-server.ts', 'server')
})

Thanks for the hard work, @JorgenVatle!

@JorgenVatle
Copy link
Owner

Hey there. Sorry I couldn't get back to you earlier.

I still haven't quite familiarized myself with Meteor 3. I believe we do depend fairly heavily on fibers for the build process. Do you have any docs yet for the changes to Meteor's build system?

In the meantime, I'll do some tinkering and get back to you once I know more.

@JorgenVatle
Copy link
Owner

Turns out the migration to Meteor v3 wasn't all that bad. Could you give it a go with the meteor-v3 branch from #83?

There'll be an example app using Meteor v3.0-beta.0 and Vue. Got some quick tests done locally and it seems to run just fine with Meteor v3 now, at least for that one example app. 😅

Let me know how it goes. 🤞

@Grubba27
Copy link
Author

Do you have any docs yet for the changes to Meteor's build system?

I'm afraid we do not currently :/

I added to my to-do to test it again

@github-actions github-actions bot mentioned this issue Jan 18, 2024
1 task
@JorgenVatle
Copy link
Owner

Just had a deeper look at the changes introduced by Meteor v3. Seems like client bundle format has changed since V2. So there's still a little work left to be done before we have full compatibility with core Meteor packages.

I'll follow up with you once we have a stable patch ready to go. 👍

@Grubba27
Copy link
Author

Sure! Could you write your experience with updating a build plugin? That would also be great for other developers who might need to update their build plugins. I will be working on an in-depth how-to guide on updating to 3.0, and hearing people who already took the migration helps a lot in this effort.

@JorgenVatle
Copy link
Owner

I really didn't have to do a whole lot there. If I recall correctly, the only issue I ran into when running Meteor v3 was build plugins would not registering correctly when done asynchronously. Meteor-Vite would only register the plugin at the end of the Vite build process. Registering the build plugin asynchronously like we did previously would cause builds to fail and on occasion succeed.

Just registering the build plugin immediately and then optionally throwing in an "await" as a failsafe into the compiler's processFilesForTarget method seems to have resolved those issues. I think in most cases, the migration steps for plugin authors would be minimal, at least from what I've gathered so far.

@JorgenVatle JorgenVatle mentioned this issue Jan 29, 2024
3 tasks
@JorgenVatle
Copy link
Owner

JorgenVatle commented Jan 29, 2024

@Grubba27 The v1.9.0 release of meteor-vite adds support for Meteor v3. I've only tested with core packages so far. If you run into any issues please do re-open the issue, or create a new one if that makes more sense. 🙌

@JorgenVatle
Copy link
Owner

@Grubba27 Just noticed that when publishing jorgenvatle:vite-bundler using the current stable version of Meteor, fibers would silently be added as a dependency. Only when publishing using a --release 3.0-beta.0 flag, the package would be published as expected.

@JorgenVatle
Copy link
Owner

You can pull down the Meteor-v3-built version of the package with jorgenvatle:vite-bundler@2.0.0-beta.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants