Closed colearendt closed 1 year ago
NOTE: in case it is helpful - I am also using some other deps, so I suppose it is possible something else is involved here too... nothing feels out of the ordinary though:
"dependencies": {
"@vitejs/plugin-vue": "^3.1.0",
"events": "^3.3.0",
"path": "^0.12.7",
"pouchdb": "^7.3.0",
"pouchdb-browser": "^7.3.1",
"pouchdb-core": "^7.3.1",
"pouchdb-node": "^7.3.1",
"process": "^0.11.10",
"vite": "~3.1",
"vite-plugin-chrome-extension": "^0.0.7",
"vite-plugin-vuetify": "^1.0.0-alpha.17",
"vite-plugin-web-extension": "^1.4.4",
"vue": "^3.2.39",
"vuetify": "^3.0.0-beta.11"
}
And vite.config.ts
import { resolve } from "path";
import { defineConfig } from "vite";
// @ts-ignore
import webExtension from "vite-plugin-web-extension";
import vue from '@vitejs/plugin-vue'
import vuetify from 'vite-plugin-vuetify'
import * as path from "path";
export default defineConfig({
root: "src",
logLevel: 'info',
resolve: {
alias: {
"@": resolve(__dirname, "src"),
},
},
build: {
minify: false,
outDir: path.resolve(__dirname, "dist"),
emptyOutDir: true,
},
plugins: [
webExtension({
manifest: "src/manifest.json",
assets: "other",
}),
vue(),
vuetify({autoImport: true}),
],
})
More bad-ish news (for me). I migrated to using the budding/beta v2
version (vite-plugin-web-extension@next
) and am still seeing the same behavior. Next step is to see if I can create a more minimal reprex repository.
Ugh. After all the digging I did, starting a repository from scratch is not illustrating this behavior... š
Through a bunch of diffing / tweaking / comparing, the issue came down to this benign-looking line in my vite.config.ts
, which I excluded above in trying to make the config more palatable... little would I ever have imagined that this line creates this behavior...
assetsInclude: [],
BEWARE the assetsInclude
š±
Here is a trimmed down example - latest commit breaks in this way: https://github.com/colearendt/extensions-example
Sorry this was so hard to debug! I have no idea why assetsInclude: undefined
is different than assetsInclude: []
. The docs don't hint at anything.
I can forcefully ignore that option inside the plugin, but that might cause issues for someone else down the line who knows how to use that field properly. Instead, if this happens to anyone else, hopefully they can find this issue and the solution works for them.
// vite.config.ts
export default defineConfig({
...
- assetsInclude: someValue,
});
Let me know if you have any other problems!
Thanks, I think that sounds like the right call too! My extension is now happy and healthy - thanks again for the great package!
Part of it feels like this may be a bug in vite
too, so I will probably go toss an issue their direction in case it crops up elsewhere š
Just a note that this issue was fixed upstream in vite! š
Nice!
Hello. This package has been a huge help! However, I am running into an issue right near what I presume is the finish line in getting my extension migrated to
vite
. Unfortunately, I am having a very difficult time figuring out where the root problem is at.TL;DR;
popup.popup.html
is getting built twice. Once atpopup.html
with expected contents, and once atpopup/popup.html
with "empty" / placeholder contents. If I flatten the folder structure, the latter / useless one wins.Directory structure:
manifest.json
(essentially the same as this e2e test... which works for me... but I still cannot get my plugin to): https://github.com/aklinker1/vite-plugin-web-extension/blob/2517ce065d3264c93b0c9e5a5796f3c905796c4a/packages/e2e/e2e.test.ts#L69-L77
build log
Note that there are two output
popup.html
files... one with my actual contents (dist/popup.html
) and another (dist/popup/popup.html
) with contents:export default "/popup.html"
.Unfortunately, the path pointed to by the extension is
popup/popup.html
, so my extension is not usable. No foray through several iterations ofadditionalInputs
, different file structures, verbose logging, rollup options, etc. have been helpful. Further, if I change or flatten the folder structure, it seems that the blankpopup.html
is generated last / wins with a message"popup.html" overwrites a previously emitted file of the same name
.I have tried different versions of vite in the 3.0 line, and it seems to affect both 3.1 and 3.2. I have seen some related-ish looking activity on vite lately though - maybe I will try the e2e tests with newer versions of deps.
https://github.com/vitejs/vite/pull/9928
Any ideas how to keep debugging / resolve this "double build" issue?