TriPSs / nx-extend

Nx Workspaces builders and tools
MIT License
169 stars 47 forks source link

Strapi build admin dashboard did not read from admin.ts config with webpack compile #321

Open fallingforest opened 1 month ago

fallingforest commented 1 month ago

I got the issue while build the strapi admin dashboard. it does not read the admin.ts config when building to html, js files

This is my admin.ts file:

export default ({ env }) => ({
  auth: {
    secret: env('ADMIN_JWT_SECRET'),
  },
  apiToken: {
    salt: env('API_TOKEN_SALT'),
  },
  transfer: {
    token: {
      salt: env('TRANSFER_TOKEN_SALT'),
    },
  },
  flags: {
    nps: env.bool('FLAG_NPS', true),
    promoteEE: env.bool('FLAG_PROMOTE_EE', true),
  },
  url: '/',
  serveAdminPanel: env('NODE_ENV') !== 'production' ? true : false,
  watchIgnoreFiles: ['**/config/sync/**'],
});

This is the webpack.config.js file:

'use strict';

const { withNx } = require('@nx-extend/strapi');

module.exports = (config, webpack) => {
  return withNx(config, webpack);
};

I set the url is "/". but when the index.html built, it always return this script path: <script defer="defer" src="/admin/runtime~main.*.js">

While when I used the yarn build script with a normal strapi project without nx, it will return like this: <script defer="defer" src="/runtime~main.*.js">

TriPSs commented 1 month ago

Please provide some more info, package version, Strapi version etc.

fallingforest commented 1 month ago

Here are some info:

NX   Report complete - copy this into the issue template

Node           : 20.16.0
OS             : linux-x64
Native Target  : x86_64-linux
yarn           : 1.22.22

nx (global)        : 19.6.1
nx                 : 19.6.2
@nx/js             : 19.6.2
@nx/jest           : 19.6.2
@nx/linter         : 19.6.2
@nx/eslint         : 19.6.2
@nx/workspace      : 19.6.2
@nx/cypress        : 19.6.2
@nx/devkit         : 19.6.2
@nx/esbuild        : 19.6.3
@nx/eslint-plugin  : 19.6.2
@nx/nest           : 19.6.2
@nx/next           : 19.6.2
@nx/node           : 19.6.2
@nx/react          : 19.6.2
@nrwl/tao          : 19.6.2
@nx/vite           : 19.6.2
@nx/web            : 19.6.2
@nx/webpack        : 19.6.2
typescript         : 5.5.4
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
---------------------------------------
Community plugins:
@nx-extend/strapi                : 11.0.1
@nx-tools/nx-container           : 5.3.1
@trumbitta/nx-plugin-unused-deps : 1.12.1
---------------------------------------