0

I'm a little new to Angular so hopefully what I'm having issues with is possible to fix.

In my Angular project, when we run ng build we compile the source into a specific desination directory in our webapp folder called ng. We're including some modules that need to use some fontawesome and roboto-v15 font files so it appears to copy the required font files over to the ng directory (The files are named like fontawesome-webfont.af7ae505a9eed503f8b8.woff2 and fontawesome-webfont.b06871f281fee6b241d6.ttf).

On the pages where we include the angular module it tries to request these files using the Base URL of the page we're currently on, when in reality I need it to look in the ng directory instead

For example when I load up the page I get these 404 errors in the console:

NetworkError: 404 Not Found - http://localhost:8080/test/url/roboto-v15-latin-regular.7e367be02cd17a96d513.woff2.

I need to configure the angular compiler to tell it that these files are instead located at http://localhost:8080/ng/roboto-v15-latin-regular.7e367be02cd17a96d513.woff2.

When I take a look at the compiled styles.bundle.js I can find references to the resource files it's putting into the style on the page. Here's what that looks like:

/***/ "../../../../primeng/resources/themes/omega/fonts/roboto-v15-latin-regular.woff":
/***/ (function(module, exports, __webpack_require__) {

module.exports = __webpack_require__.p + "roboto-v15-latin-regular.16e1d930cf13fb7a9563.woff";

/***/ }),

If I could figure out what config setting can set the __webpack_require__.p variable to ng/ then it would be perfect. At the moment I'm manually importing these font files on the page itself, but I have a feeling this is going to be a problem if I ever want to use other modules that happen to compile some resource files.

1 Answer 1

0

After some more digging I've realized my question was kind of poorly phrased. I found the answer to what I was looking for here:

How to set the public path on angular 4

The setting I was looking for was to try and set the public path for my resource files. This setting is controlled by the deployUrl parameter in .angular-cli.json

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.