Material Web with Material Design 2, I could use web components like mwc-button
, by importing module from unpkg or transpiling (or bundling) to a JavaScript file (ex. mwc-bundle-button.js) from the NPM package.
<script defer
type="module"
src='https://unpkg.com/@@material/mwc-button?module'>
</script>
or
<script defer
type="module"
src='../(path)/web-components/mwc-bundle-button.js'>
</script>
<mwc-button label="button label"></mwc-button>
Material Web with Material You (Material Design 3), there are still no NPM package (@material/web) at 2022/06/29.
I want to try some web components with Material You, but I do not know how to transpile the repository to JavaScript files.
I tried,
- git clone Lit starter kit (maybe use Lit in material-web)
- download the material-web repository in the [Lit starter kit]
build
(maybetsc
) about icon.ts for transpiling to JavaScript filesrollup -c
for bundle to one JavaScript file
Then, TS2307: Cannot find module './lib/icon-styles.css' or its corresponding type declarations.
is occurred.
Is this the right direction? (Can I reach the goal by solving some errors?)
Or, Do I have a misunderstanding?