feat(nuxt): Improve logs about adding Node option 'import'#13726
feat(nuxt): Improve logs about adding Node option 'import'#13726
Conversation
| }); | ||
| }); | ||
|
|
||
| describe('getStringDiff', () => { |
There was a problem hiding this comment.
l:
| describe('getStringDiff', () => { | |
| describe('getStringSuffixDiff', () => { |
| expect(getStringSuffixDiff('', 'abc')).toBe(''); | ||
| }); | ||
|
|
||
| it('should return the suffix of the longer string when the shorter string is a prefix', () => { |
There was a problem hiding this comment.
l (no action required): what happens if the longer string is shorter (but not empty) that the shorter string param? 😅
packages/nuxt/src/module.ts
Outdated
| `[Sentry] Using your \`${serverConfigFile}\` file for the server-side Sentry configuration. In case you have a \`public/instrument.server\` file, the \`public/instrument.server\` file will be ignored. Make sure the file path in your node \`--import\` option matches the Sentry server config file in your \`.output\` folder and has a \`.mjs\` extension.`, | ||
| ); | ||
| }); | ||
| const serverConfigRelativePath = `.${getStringSuffixDiff(serverConfigPath, nitro.options.rootDir)}`; |
There was a problem hiding this comment.
no strong opinions but shouldn't path.relative basically do what you're trying to do here? (I might be missing something though)
packages/nuxt/src/module.ts
Outdated
| ); | ||
| }); | ||
| // For the default nitro node-preset build output this relative path would be: ./.output/server/sentry.server.config.mjs | ||
| const serverConfigRelativePath = `./${path.relative(nitro.options.rootDir, serverConfigPath)}`; |
There was a problem hiding this comment.
Let's use path.join instead of ./ as the / separator does not work in windows. In this case doesn't matter a ton, but always good to it consistent.
There was a problem hiding this comment.
Good catch with windows! I could not use path.join in this case as this would not keep the folder name with the dot (.output). But I was able to achieve this with .${path.sep}${path.relative(...)}
# Conflicts: # packages/nuxt/src/module.ts
Adding the node option can be a confusing step. This adds a log output which already includes the correct file path to add. It looks like this: