forked from mystiq/hydrogen-web
Merge pull request #746 from vector-im/madlittlemods/assets-path-for-assets
Import SDK assets from the `assets/` directory
This commit is contained in:
commit
fba3275f5b
4 changed files with 9 additions and 7 deletions
|
@ -48,8 +48,8 @@ const assetPaths = {
|
|||
wasmBundle: olmJsPath
|
||||
}
|
||||
};
|
||||
import "hydrogen-view-sdk/theme-element-light.css";
|
||||
// OR import "hydrogen-view-sdk/theme-element-dark.css";
|
||||
import "hydrogen-view-sdk/assets/theme-element-light.css";
|
||||
// OR import "hydrogen-view-sdk/assets/theme-element-dark.css";
|
||||
|
||||
async function main() {
|
||||
const app = document.querySelector<HTMLDivElement>('#app')!
|
||||
|
|
|
@ -13,7 +13,7 @@ const assetPaths = {
|
|||
wasmBundle: olmJsPath
|
||||
}
|
||||
};
|
||||
import "hydrogen-view-sdk/theme-element-light.css";
|
||||
import "hydrogen-view-sdk/assets/theme-element-light.css";
|
||||
|
||||
console.log('hydrogenViewSdk', hydrogenViewSdk);
|
||||
console.log('assetPaths', assetPaths);
|
||||
|
|
|
@ -6,7 +6,7 @@ const hydrogenViewSdk = require('hydrogen-view-sdk');
|
|||
// Worker
|
||||
require.resolve('hydrogen-view-sdk/main.js');
|
||||
// Styles
|
||||
require.resolve('hydrogen-view-sdk/theme-element-light.css');
|
||||
require.resolve('hydrogen-view-sdk/assets/theme-element-light.css');
|
||||
// Can access files in the assets/* directory
|
||||
require.resolve('hydrogen-view-sdk/assets/main.js');
|
||||
|
||||
|
|
|
@ -3,8 +3,9 @@ const mergeOptions = require('merge-options');
|
|||
const themeBuilder = require("./scripts/build-plugins/rollup-plugin-build-themes");
|
||||
const {commonOptions, compiledVariables} = require("./vite.common-config.js");
|
||||
|
||||
// These paths will be saved without their hash so they havea consisent path to
|
||||
// reference
|
||||
// These paths will be saved without their hash so they have a consisent path
|
||||
// that we can reference in our `package.json` `exports`. And so people can import
|
||||
// them with a consistent path.
|
||||
const pathsToExport = [
|
||||
"main.js",
|
||||
"download-sandbox.html",
|
||||
|
@ -21,7 +22,8 @@ export default mergeOptions(commonOptions, {
|
|||
output: {
|
||||
assetFileNames: (chunkInfo) => {
|
||||
// Get rid of the hash so we can consistently reference these
|
||||
// files in our `package.json` `exports`
|
||||
// files in our `package.json` `exports`. And so people can
|
||||
// import them with a consistent path.
|
||||
if(pathsToExport.includes(path.basename(chunkInfo.name))) {
|
||||
return "assets/[name].[ext]";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue