Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read coreApp assets directly from package #144492

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions packages/core/apps/core-apps-server-internal/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ PKG_REQUIRE_NAME = "@kbn/core-apps-server-internal"
SOURCE_FILES = glob(
[
"**/*.ts",
"src/**/*.css",
"src/**/*.ttf",
"src/**/*.woff",
"src/**/*.woff2",
"src/**/*.ico",
"src/**/*.png",
"src/**/*.svg",
],
exclude = [
"**/*.config.js",
Expand All @@ -38,8 +31,16 @@ filegroup(
srcs = SRCS,
)

ASSETS = glob(["assets/**/*"])

filegroup(
name = "assets",
srcs = ASSETS,
)

NPM_MODULE_EXTRA_FILES = [
"package.json",
":assets"
]
Comment on lines +34 to 44
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, what does that do exactly?

But I think I spotted the problem:

This PR moved the assets from {package}/src/assets to {package}/assets. However you did not change the path in the route registered to serve them:

private registerStaticDirs(core: InternalCoreSetup | InternalCorePreboot) {
core.http.registerStaticDir('/ui/{path*}', Path.resolve(__dirname, './assets'));

Changing the Path.resolve(__dirname, './assets') to target the correct folder should hopefully do the trick.


RUNTIME_DEPS = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* Side Public License, v 1.
*/

import Path from 'path';
import { stringify } from 'querystring';
import { Env } from '@kbn/config';
import { schema } from '@kbn/config-schema';
Expand Down Expand Up @@ -202,8 +201,13 @@ export class CoreAppsService {
});
}

// After the package is built and bootstrap extracts files to bazel-bin,
// assets are exposed at the root of the package and in the package's node_modules dir
private registerStaticDirs(core: InternalCoreSetup | InternalCorePreboot) {
core.http.registerStaticDir('/ui/{path*}', Path.resolve(__dirname, './assets'));
core.http.registerStaticDir(
'/ui/{path*}',
fromRoot('node_modules/@kbn/core-apps-server-internal/assets')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to load these assets from their location post-build.

);

core.http.registerStaticDir(
'/node_modules/@kbn/ui-framework/dist/{path*}',
Expand Down
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
4 changes: 0 additions & 4 deletions src/core/server/core_app/assets/favicons/favicon.svg

This file was deleted.

Loading