Eric Eastwood
2b4a7f05a6
Fix Vite not being able analyze dynamic CSS styles import in dev
...
Fix:
```
$ yarn start
[vite] warning:
@theme/default
1 | import "C:\Users\MLM\Documents\GitHub\element\hydrogen-web\src\platform\web\ui\css\themes\element\theme.css";import "@theme/element/light/variables.css"
| ^
The above dynamic import cannot be analyzed by vite.
See https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#limitations for supported dynamic import formats. If this is intended to be left as-is, you can use the /* @vite-ignore */ comment inside the import() call to suppress this warning.
Plugin: vite:import-analysis
File: @theme/default
```
And in the browser, it results in none of the styles loading because of the following error:
```
Uncaught SyntaxError: Invalid Unicode escape sequence (at default:formatted:1:163)
```
---
Before:
```
import { injectQuery as __vite__injectQuery } from "/@vite/client";import "__vite__injectQuery(C:\Users\MLM\Documents\GitHub\element\hydrogen-web\src\platform\web\ui\css\themes\element\theme.css, 'import')";import "/@id/__x00__@theme/element/light/variables.css"
```
After:
```
import "/ui/css/themes/element/theme.css";import "/@id/__x00__@theme/element/light/variables.css"
```
2022-06-07 23:41:45 -05:00
Bruno Windels
f21e103270
add newlines to config file when rewriting with theme stuff
2022-05-18 20:46:38 +02:00
Bruno Windels
8a5f1ed9cd
Merge remote-tracking branch 'origin/move-config-root'
2022-05-18 20:40:12 +02:00
RMidhunSuresh
683ffa9ed3
injectServiceWorker plugin should accept callback
2022-05-18 17:31:17 +05:30
RMidhunSuresh
34e8b60917
Create config.json in root
2022-05-12 16:05:33 +05:30
RMidhunSuresh
4ddfd3b508
built-asset --> built-assets
2022-05-12 14:56:58 +05:30
RMidhunSuresh
855298bdaf
Read from manifest
2022-05-11 12:40:32 +05:30
RMidhunSuresh
e8a4ab5ecc
built-asset must be a mapping
...
A mapping from theme-name to location of css file
2022-05-10 16:58:06 +05:30
RMidhunSuresh
5204fe5c99
This emitFile is no longer needed
2022-05-10 14:22:37 +05:30
RMidhunSuresh
af9cbd727f
Remove existing stylesheets when changing themes
2022-05-10 14:12:36 +05:30
RMidhunSuresh
12a70469eb
Fix formatting
2022-05-10 14:12:36 +05:30
RMidhunSuresh
c611d3f85c
Select current theme in dropdown
2022-05-10 14:12:36 +05:30
RMidhunSuresh
daae7442bb
Create theme chooser
2022-05-10 14:12:36 +05:30
RMidhunSuresh
cc2c74fdff
Generate theme summary on build
2022-05-10 14:12:36 +05:30
RMidhunSuresh
bf0cdcd3f1
Add explaining comment
2022-04-13 13:39:20 +05:30
RMidhunSuresh
825c9847fe
Don't hardcode theme/variant names
2022-04-13 12:56:14 +05:30
RMidhunSuresh
14523ecc5d
Use new theme option in vite-config
2022-04-13 12:40:49 +05:30
RMidhunSuresh
743bd0db1c
Support dark mode and remove dev script tag
2022-04-12 20:39:04 +05:30
RMidhunSuresh
0a95eb0940
Fix formatting
2022-04-10 14:52:26 +05:30
RMidhunSuresh
ff98ef4465
Support theming in dev server
2022-04-10 14:49:19 +05:30
RMidhunSuresh
f75ee86c0e
Change comment
2022-04-06 12:30:26 +05:30
RMidhunSuresh
7f9af5b5fa
Add icon to manifest
2022-04-06 12:30:26 +05:30
RMidhunSuresh
b0f082e81f
Add derived variables to source section
2022-04-06 12:30:26 +05:30
RMidhunSuresh
d5b5e10230
Produce manifest.jsom
2022-04-06 12:30:26 +05:30
RMidhunSuresh
86c45b5b99
Emit runtime bundle
2022-04-06 12:30:26 +05:30
RMidhunSuresh
32eb95734a
Add default themes to index html
2022-04-06 12:30:26 +05:30
RMidhunSuresh
1f6efb4db3
Write plugin code
2022-04-06 12:30:26 +05:30
Bruno Windels
ceb0b5793b
somewhat works, but not everything we need
...
it's missing still:
- non-css assets like the download sandbox and the olm worker aren't written for some reason
- the es and cjs lib.js entry points end up in assets with a hash for some reason
- in these entry files, apart from our exports, something is adding an import statement for every import that was found in the tree
- all assets are hashed even though the config tries to disable that
- tests are included
2021-12-22 16:31:18 +01:00
Bruno Windels
5c5193ef48
remove old build system and unused dependencies
...
some of these are for the ie11 legacy build, which has been
postponed. They will be brougth back when we bring back the legacy build
2021-12-09 18:04:11 +01:00
Bruno Windels
62827b92b7
implement placeholder replacement so it still works with minification
2021-12-09 16:37:31 +01:00
Bruno Windels
9a82f88e1f
log swSource as build fails in CI
2021-12-09 15:13:19 +01:00
Bruno Windels
23e0d3f2ff
get notification badge icon url through import now we transpile the sw
2021-12-09 15:13:05 +01:00
Bruno Windels
a4fac68393
use same method for setting version and build hash placeholder in sw
...
also better naming in service worker plugin
2021-12-09 14:36:12 +01:00
Bruno Windels
14dffa4ad4
remove leftover logging
2021-12-09 12:21:34 +01:00
Bruno Windels
8e4da396ea
replace global hash in given chunks
2021-12-09 12:15:17 +01:00
Bruno Windels
c344032c0a
transpile service worker and cleanup build plugin
2021-12-09 11:39:28 +01:00
Bruno Windels
fb8149b6cf
add base to manifest path, just for completeness
2021-12-08 18:29:07 +01:00
Bruno Windels
0e2a22f509
also look in chunks for cacheable assets for service worker
2021-12-06 15:34:39 +01:00
Bruno Windels
91e69a2bd0
fix icons in manifest not being found
2021-12-06 15:25:44 +01:00
Bruno Windels
7148f6fd41
wip to not babel deps
2021-11-10 19:10:23 +01:00
Bruno Windels
36a982f7e2
WIP to run rollup twice, first with vite and babel, then to inline deps
2021-11-09 18:10:12 +01:00
Bruno Windels
122528f9a9
also transpile typescript files
...
note that these have already been converted to javascript by vite
2021-11-09 17:59:58 +01:00
Bruno Windels
da7f66a531
setup babel for legacy build as input transform plugin
2021-11-09 14:52:03 +01:00
Bruno Windels
fcde507183
WIP
2021-11-08 11:13:02 +01:00
Bruno Windels
7dce579ac3
make babel plugin run after commonjs one added by vite
2021-11-08 11:12:19 +01:00
Bruno Windels
16918ddb7d
ie11 build wip
2021-11-08 11:12:13 +01:00
Bruno Windels
eb60f6717a
add comment for improvements
2021-11-08 11:10:34 +01:00
Bruno Windels
923a1a2057
use vite define option to inject version number everywhere
2021-11-08 11:10:34 +01:00
Bruno Windels
216afd45cc
vite/rollup plugin to inject and transform manifest & service worker
2021-11-08 11:10:34 +01:00