-
-
Notifications
You must be signed in to change notification settings - Fork 210
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
Upgrade to v0.21.0 doesn't seem to work with Vite #785
Comments
Yes, both were updated to |
My config looks something like the following, which may help: const pwaOptions: Partial<VitePWAOptions> = {
manifest: {
id: '/',
scope: '/',
theme_color: '#000000',
icons: [
{
src: 'pwa-64x64.png',
sizes: '64x64',
type: 'image/png',
},
{
src: 'pwa-192x192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: 'pwa-512x512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'any',
},
{
src: 'maskable-icon-512x512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'maskable',
},
],
},
registerType: 'prompt',
devOptions: {
enabled: true,
type: 'module',
},
base: '/',
scope: '/',
srcDir: 'src',
filename: 'service-worker.ts',
strategies: 'injectManifest',
injectManifest: {
maximumFileSizeToCacheInBytes: 5120000,
injectionPoint: undefined,
},
pwaAssets: {
config: true,
overrideManifestIcons: true,
},
}; |
I guess it is not related to pwa plugin, can you try disabling the pwa and run the build command, the build pwa internal plugin will re-throw any error in the build, there is no trace in your stacktrace about pwa plugin, looks like the client build is falling. Can you share your vite config file? |
I've tested with all frameworks lib (test script here, old Vite version), so maybe we need a custom tsconfig.json for the service worker, but it is weird that running with previous pwa plugin version works. We've changed only workbox versions removing old rollup from dependencies (moved to |
The application build works fine, it errors when the PWA is built. |
Here is a more complete log:
|
I've reduced this to not passing any config to the PWA plugin, and also removing all code from the service worker, same result. |
So the problem when Vite building the sw? We use a custom Vite build, what was previous pwa plugin version? What's your tsconfig.json file? maybe you can move the service worker to its own folder with a custom tsconfig.json file. |
Yep, currently on
{
"$schema": "http://json.schemastore.org/tsconfig",
"compilerOptions": {
"baseUrl": "./src",
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"incremental": false,
"allowJs": true,
"checkJs": false,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"types": ["node", "unplugin-icons/types/react"],
"paths": {
"*": ["./@types/*"]
}
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.mts",
"src/**/*.cts",
".storybook/*.ts",
".storybook/*.tsx",
"vite*.ts",
"serve*.ts",
"orval*.ts",
"codegen.ts",
"pwa-assets.config.ts",
"openapi*.cts"
]
}
|
any chance to share the repo? |
Unfortunately not, its pretty much our full platform which is proprietary, but more than happy to try things and feedback. Tried everything that I could think of to bisect and pin-point, but so far, no luck :) |
what plugins do you have in your vite config file? |
A couple, I've tried removing them all pretty much, but haven't had any luck with that either:
|
Try creating a If you're using /// <reference types="vite/client" />
/// <reference lib="webworker" /> // src/service.worker/tsconfig.json
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ESNext", "WebWorker", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
"types": ["vite/client"],
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["."],
"exclude": []
} |
Ok. That didn't help either, but I seem to have figured out what is going on. It seems like pnpm has screwed this up somehow. What I've done is to remove my There is/was some weird interaction between rollup and babel as far as I can tell. Really appreciate your help and suggestions. Clearly, this isn't a bug with |
I've updated to
0.21.0
, but there seems to be an interaction with vite/babel:The text was updated successfully, but these errors were encountered: