Skip to content

Commit

Permalink
Fix: assets path for index.js query (flyteorg#412)
Browse files Browse the repository at this point in the history
* Fix assets path for index.js query

Signed-off-by: Alex Bain (Level 5 US)/Alex Bain <[email protected]>

* chore: remove item folder fof assets

Signed-off-by: Nastya Rusina <[email protected]>

Co-authored-by: Alex Bain (Level 5 US)/Alex Bain <[email protected]>
  • Loading branch information
anrusina and Alex Bain (Level 5 US)/Alex Bain authored Apr 21, 2022
1 parent 2995f3c commit 940116f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ if (process.env.NODE_ENV === 'production') {
const clientStats = require('./dist/client-stats.json');
const distPath = path.join(__dirname, 'dist');
app.use(
`${env.BASE_URL}/`,
// This path should be in sync with the `publicPath` from webpack config.
`${env.BASE_URL}/assets`,
expressStaticGzip(distPath, {
maxAge: '1d',
}),
Expand Down
10 changes: 7 additions & 3 deletions webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ export const serviceName = process.env.SERVICE_NAME || 'not set';
/** Absolute path to webpack output folder */
export const dist = path.join(__dirname, 'dist');

/** Webpack public path. All emitted assets will have relative path to this path */
export const publicPath = `${env.BASE_URL}/`;
/** Webpack public path. All emitted assets will have relative path to this path
* every time it is changed - the index.js app.use should also be updated.
*/
export const publicPath = `${env.BASE_URL}/assets/`;

/** True if we are in development mode */
export const isDev = env.NODE_ENV === 'development';
Expand Down Expand Up @@ -107,7 +109,9 @@ export const htmlPlugin = new HTMLWebpackPlugin({

export const favIconPlugin = new FavIconWebpackPlugin({
logo: path.resolve(__dirname, 'src/assets/favicon.png'),
prefix: 'assets/', // we can add '[fullhash:8]/' to the end of the file in future
// we can add '[fullhash:8]/' to the end of the file in future
// if this one will be changed - ensure that OneClick will still be working
prefix: './',
});

/** Write client stats to a JSON file for production */
Expand Down

0 comments on commit 940116f

Please sign in to comment.