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

Replace Webpack with Vite #4765

Merged
merged 116 commits into from Feb 16, 2023
Merged

Replace Webpack with Vite #4765

merged 116 commits into from Feb 16, 2023

Conversation

hanspagel
Copy link
Collaborator

@hanspagel hanspagel commented Jan 24, 2023

This PR replaces Webpack with Vite.

Benefits

  • Vite embraces native ECMAScript modules (and that’s the future we all strive for)
  • Vite is really fast (HMR ~1,500ms vs ~50ms, build time ~45s vs. ~30s)
  • Vite configuration is easier to work with (opinion)

Workarounds

  1. When using the prosemirror-math module an import from katex is broken. I worked around this with patch-package which applies Git patches to npm dependencies through a npm postinstall hook.
    I’d create a PR, but the package seems to be unmaintained and I wasn’t able to solve it through configuration. If we somehow could force Vite to use the CommonJS version of prosemirror-math it would work.

  2. The dependency workbox-core (used for the Service Worker) throws TypeScript exceptions and there’s no way to ignore them through the tsconfig. The only workaround I found is to enable skipLibCheck, which then skips type checking for all .d.ts files … Which is not really what we want, but solves the issue.

Tasks

  • Test the Service Worker in production.
  • Execute service worker code for everyone (remove the localStorage check).

Testing the Service Worker

Execute the following code in the browser console and refresh the page:

localStorage.setItem("installServiceWorker", true)

@hanspagel hanspagel temporarily deployed to outline-app-staging February 13, 2023 16:34 Inactive
app/stores/BaseStore.ts Outdated Show resolved Hide resolved
@tommoor tommoor temporarily deployed to outline-app-staging February 14, 2023 01:01 Inactive
@tommoor tommoor temporarily deployed to outline-app-staging February 15, 2023 02:42 Inactive
@tommoor tommoor temporarily deployed to outline-app-staging February 15, 2023 02:54 Inactive
@tommoor tommoor force-pushed the feat/replace-webpack-with-vite branch from 9cee5f1 to b73cc76 Compare February 15, 2023 15:02
@tommoor tommoor temporarily deployed to outline-app-staging February 16, 2023 02:11 Inactive
@tommoor
Copy link
Member

tommoor commented Feb 16, 2023

A version of this is now in production, the only problem is that the paths in the sw.js do not contain the CDN host which is putting a lot of extra requests on the app servers. Looking into that now…

@tommoor tommoor temporarily deployed to outline-app-staging February 16, 2023 02:56 Inactive
@tommoor tommoor temporarily deployed to outline-app-staging February 16, 2023 03:20 Inactive
@tommoor tommoor merged commit e754f89 into main Feb 16, 2023
@delete-merged-branch delete-merged-branch bot deleted the feat/replace-webpack-with-vite branch February 16, 2023 03:39
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 this pull request may close these issues.

None yet

3 participants