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

suggest a better solution for monorepo building without tscalias. #4

Open
caoer opened this issue Sep 11, 2023 · 1 comment
Open

suggest a better solution for monorepo building without tscalias. #4

caoer opened this issue Sep 11, 2023 · 1 comment

Comments

@caoer
Copy link

caoer commented Sep 11, 2023

we have similar setup but ends up with better solution:
using tsconfig-paths-webpack-plugin with following code can avoid touch build result

import { TsconfigPathsPlugin } from 'tsconfig-paths-webpack-plugin';

  const worker = await Worker.create({
    connection,
    workflowBundle:
      env.NODE_ENV === 'production'
        ? {
            codePath: path.resolve(__dirname, './workflow-bundle.js'),
          }
        : await bundleWorkflowCode({
            workflowsPath: path.resolve(
              process.env['NX_WORKSPACE_ROOT']!,
              'packages/libs/temporal-workflow/src/workflows',
            ),
            webpackConfigHook: config => {
              if (config.resolve!.plugins == null) {
                config.resolve!.plugins = [
                  new TsconfigPathsPlugin({
                    configFile: path.resolve(
                      process.env['NX_WORKSPACE_ROOT']!,
                      'packages/libs/temporal-workflow/tsconfig.lib.json',
                    ),
                  }),
                ];
              } else {
                throw new Error(`config.resolve.plugins is not null`);
              }
              return config;
            },
          }),
@jelling
Copy link

jelling commented Feb 10, 2024

Fwiw we are also using TsconfigPathsPlugin and it works quite well.

Regardless, cheers for putting together this repo as it was a great sanity-check while trying to get NX + Temporal working together.

Are you open to PRs? I learned a few things that hard way when it came to NX + Temporal and I would be happy to contribute them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants