mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
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
@ -48,8 +48,8 @@ const assetPaths = {
|
|||||||
wasmBundle: olmJsPath
|
wasmBundle: olmJsPath
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
import "hydrogen-view-sdk/theme-element-light.css";
|
import "hydrogen-view-sdk/assets/theme-element-light.css";
|
||||||
// OR import "hydrogen-view-sdk/theme-element-dark.css";
|
// OR import "hydrogen-view-sdk/assets/theme-element-dark.css";
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const app = document.querySelector<HTMLDivElement>('#app')!
|
const app = document.querySelector<HTMLDivElement>('#app')!
|
||||||
|
@ -13,7 +13,7 @@ const assetPaths = {
|
|||||||
wasmBundle: olmJsPath
|
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('hydrogenViewSdk', hydrogenViewSdk);
|
||||||
console.log('assetPaths', assetPaths);
|
console.log('assetPaths', assetPaths);
|
||||||
|
@ -6,7 +6,7 @@ const hydrogenViewSdk = require('hydrogen-view-sdk');
|
|||||||
// Worker
|
// Worker
|
||||||
require.resolve('hydrogen-view-sdk/main.js');
|
require.resolve('hydrogen-view-sdk/main.js');
|
||||||
// Styles
|
// 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
|
// Can access files in the assets/* directory
|
||||||
require.resolve('hydrogen-view-sdk/assets/main.js');
|
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 themeBuilder = require("./scripts/build-plugins/rollup-plugin-build-themes");
|
||||||
const {commonOptions, compiledVariables} = require("./vite.common-config.js");
|
const {commonOptions, compiledVariables} = require("./vite.common-config.js");
|
||||||
|
|
||||||
// These paths will be saved without their hash so they havea consisent path to
|
// These paths will be saved without their hash so they have a consisent path
|
||||||
// reference
|
// that we can reference in our `package.json` `exports`. And so people can import
|
||||||
|
// them with a consistent path.
|
||||||
const pathsToExport = [
|
const pathsToExport = [
|
||||||
"main.js",
|
"main.js",
|
||||||
"download-sandbox.html",
|
"download-sandbox.html",
|
||||||
@ -21,7 +22,8 @@ export default mergeOptions(commonOptions, {
|
|||||||
output: {
|
output: {
|
||||||
assetFileNames: (chunkInfo) => {
|
assetFileNames: (chunkInfo) => {
|
||||||
// Get rid of the hash so we can consistently reference these
|
// 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))) {
|
if(pathsToExport.includes(path.basename(chunkInfo.name))) {
|
||||||
return "assets/[name].[ext]";
|
return "assets/[name].[ext]";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user