Monorepo "Could not resolve" errors @0.7.3
See original GitHub issueHello yβall!
I wanted to start using this package unfortunately as soon as I ran npx mailing
I received a lot of could not resolve
errors
Quick Information
- Operating System: Windows 10
- βmailingβ: β^0.7.3β,
- βmailing-coreβ: β^0.7.3β,
- βnextβ: β^12.2.0β,
- βreactβ: β17.0.2β,
- βreact-domβ: β17.0.2β,
What Happened?
- installed
mailing
andmailing-core
in one of my turborepo apps - ran
npx mailing
- got the following error in my terminal
ββββ ββββ ββββββ ββββββ βββββββ βββ βββββββ
βββββ βββββββββββββββββββ ββββββββ βββββββββββ
βββββββββββββββββββββββββ βββββββββ ββββββ ββββ
βββββββββββββββββββββββββ ββββββββββββββββ βββ
βββ βββ ββββββ ββββββββββββββββββββ βββββββββββββββ
βββ ββββββ ββββββββββββββββββββ βββββ βββββββ
mailing added mailing.config.json to your project with the following contents:
{
"typescript": true,
"emailsDir": "./emails",
"outDir": "./previews_html"
}
mailing generated your emails dir at ./emails:
emails
βββ TextEmail.tsx
βββ Welcome.tsx
βββ components
β βββ BulletedList.tsx
β βββ ButtonPrimary.tsx
β βββ Footer.tsx
β βββ Head.tsx
β βββ Header.tsx
β βββ theme.ts
βββ index.ts
βββ previews
βββ TextEmail.tsx
βββ Welcome.tsx
β enter your email for occasional updates about mailing (optional) ...
mailing ok, no problem
mailing starting preview server
mailing adding .gitignore
β [ERROR] Could not resolve "....emails"
.mailing/src/moduleManifest.ts:2:21:
2 β import sendMail from "..\..\emails";
β΅ ~~~~~~~~~~~~~~
You can mark the path "....emails" as external to exclude it from the bundle, which will remove
this error.
β [ERROR] Could not resolve "....emails/TextEmail"
.mailing/src/moduleManifest.ts:3:22:
3 β import TextEmail from "..\..\emails/TextEmail";
β΅ ~~~~~~~~~~~~~~~~~~~~~~~~
You can mark the path "....emails/TextEmail" as external to exclude it from the bundle, which will
remove this error.
β [ERROR] Could not resolve "....emails/Welcome"
.mailing/src/moduleManifest.ts:4:20:
4 β import Welcome from "..\..\emails/Welcome";
β΅ ~~~~~~~~~~~~~~~~~~~~~~
You can mark the path "....emails/Welcome" as external to exclude it from the bundle, which will
remove this error.
β [ERROR] Could not resolve "....emails/previews/TextEmail"
.mailing/src/moduleManifest.ts:5:34:
5 β import * as TextEmailPreview from "..\..\emails/previews/TextEmail";
β΅ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can mark the path "....emails/previews/TextEmail" as external to exclude it from the bundle,
which will remove this error.
β [ERROR] Could not resolve "....emails/previews/Welcome"
.mailing/src/moduleManifest.ts:6:32:
6 β import * as WelcomePreview from "..\..\emails/previews/Welcome";
β΅ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can mark the path "....emails/previews/Welcome" as external to exclude it from the bundle,
which will remove this error.
G:\dev\d-mls-app\node_modules\esbuild\lib\main.js:1624
let error = new Error(`${text}${summary}`);
^
Error: Build failed with 5 errors:
.mailing/src/moduleManifest.ts:2:21: ERROR: Could not resolve "....emails"
.mailing/src/moduleManifest.ts:3:22: ERROR: Could not resolve "....emails/TextEmail"
.mailing/src/moduleManifest.ts:4:20: ERROR: Could not resolve "....emails/Welcome"
.mailing/src/moduleManifest.ts:5:34: ERROR: Could not resolve "....emails/previews/TextEmail"
.mailing/src/moduleManifest.ts:6:32: ERROR: Could not resolve "....emails/previews/Welcome"
at failureErrorWithLog (G:\dev\d-mls-app\node_modules\esbuild\lib\main.js:1624:15)
at G:\dev\d-mls-app\node_modules\esbuild\lib\main.js:1266:28
at runOnEndCallbacks (G:\dev\d-mls-app\node_modules\esbuild\lib\main.js:1179:65)
at buildResponseToResult (G:\dev\d-mls-app\node_modules\esbuild\lib\main.js:1264:7)
at G:\dev\d-mls-app\node_modules\esbuild\lib\main.js:1377:14
at G:\dev\d-mls-app\node_modules\esbuild\lib\main.js:678:9
at handleIncomingPacket (G:\dev\d-mls-app\node_modules\esbuild\lib\main.js:775:9)
at Socket.readFromStdout (G:\dev\d-mls-app\node_modules\esbuild\lib\main.js:644:7)
at Socket.emit (node:events:526:28)
at addChunk (node:internal/streams/readable:315:12) {
errors: [
{
detail: undefined,
id: '',
location: {
column: 21,
file: '.mailing/src/moduleManifest.ts',
length: 14,
line: 2,
lineText: 'import sendMail from "..\\..\\emails";',
namespace: '',
suggestion: ''
},
notes: [
{
location: null,
text: 'You can mark the path "....emails" as external to exclude it from the bundle, which will remove this error.'
}
],
pluginName: '',
text: 'Could not resolve "....emails"'
},
{
detail: undefined,
id: '',
location: {
column: 22,
file: '.mailing/src/moduleManifest.ts',
length: 24,
line: 3,
lineText: 'import TextEmail from "..\\..\\emails/TextEmail";',
namespace: '',
suggestion: ''
},
notes: [
{
location: null,
text: 'You can mark the path "....emails/TextEmail" as external to exclude it from the bundle, which will remove this error.'
}
],
pluginName: '',
text: 'Could not resolve "....emails/TextEmail"'
},
{
detail: undefined,
id: '',
location: {
column: 20,
file: '.mailing/src/moduleManifest.ts',
length: 22,
line: 4,
lineText: 'import Welcome from "..\\..\\emails/Welcome";',
namespace: '',
suggestion: ''
},
notes: [
{
location: null,
text: 'You can mark the path "....emails/Welcome" as external to exclude it from the bundle, which will remove this error.'
}
],
pluginName: '',
text: 'Could not resolve "....emails/Welcome"'
},
{
detail: undefined,
id: '',
location: {
column: 34,
file: '.mailing/src/moduleManifest.ts',
length: 33,
line: 5,
lineText: 'import * as TextEmailPreview from "..\\..\\emails/previews/TextEmail";',
namespace: '',
suggestion: ''
},
notes: [
{
location: null,
text: 'You can mark the path "....emails/previews/TextEmail" as external to exclude it from the bundle, which will remove this error.'
}
],
pluginName: '',
text: 'Could not resolve "....emails/previews/TextEmail"'
},
{
detail: undefined,
id: '',
location: {
column: 32,
file: '.mailing/src/moduleManifest.ts',
length: 31,
line: 6,
lineText: 'import * as WelcomePreview from "..\\..\\emails/previews/Welcome";',
namespace: '',
suggestion: ''
},
notes: [
{
location: null,
text: 'You can mark the path "....emails/previews/Welcome" as external to exclude it from the bundle, which will remove this error.'
}
],
pluginName: '',
text: 'Could not resolve "....emails/previews/Welcome"'
}
],
warnings: []
}
- I went to check the
moduleManifest.ts
file in the.mailing/src/moduleManifest.ts
and saw the following
import config from "../../mailing.config.json";
import sendMail from "..\..\emails";
import TextEmail from "..\..\emails/TextEmail";
import Welcome from "..\..\emails/Welcome";
import * as TextEmailPreview from "..\..\emails/previews/TextEmail";
import * as WelcomePreview from "..\..\emails/previews/Welcome";
const previews = { TextEmail: TextEmailPreview, Welcome: WelcomePreview };
const templates = { TextEmail, Welcome };
export { sendMail, config, templates, previews };
const moduleManifest = { sendMail, templates, previews };
export default moduleManifest;
With red typescript errors on the paths with the following typescript error
Cannot find module '....emails' or its corresponding type declarations.ts(2307)
Expected result
- run
npx mailing
and the import paths are correct and runs with no error
Steps to reproduce
# Install a turborepo from scratch
npx create-turbo@latest
# Chose a dir
Where would you like to create your turborepo? ./mailing-test
# choose npm
? Which package manager do you want to use? npm
# CD into the web app
cd mailing-test/apps/web
# add new dependencies
npm i mailing mailing-core
#run mailing cli
npx mailing
# errors appear :(
β [ERROR] Could not resolve "....emails"
.mailing/src/moduleManifest.ts:2:21:
2 β import sendMail from "..\..\emails";
Screenshots
Please let me know if you need anything else!
Issue Analytics
- State:
- Created a year ago
- Comments:19
Top Results From Across the Web
Vercel is not working in a monorepo Β· Issue #4567 - GitHub
When I deploy using the vercel CLI the function no longer produces the error message and the application starts working. I'm using the...
Read more >Hosting all your PHP packages together in a monorepo
Learn to manage a monorepo, a tool that helps to handle the complexity of large codebases by hosting all PHP packages in a...
Read more >rbt setup-repo returns with error - git - Stack Overflow
I am using git as my code repository. While trying to setup the review board server form git cmd line rbt returns with...
Read more >Changelog - Cypress Documentation
Fixed an 11.0.0 regression where using custom reporters would cause Cypress to throw a 'Cannot find module' error. Fixes #24607; Fixed testIsolationΒ ...
Read more >Things I wish I had known when I started JavaScript monorepo ...
The reason is simple: all packages of the monorepo will be recursively installed by running npm install from monorepo root. The recursiveΒ ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@alexfarrill No more npm -g root error, but paths errors are still there. This time though they are all the same type of slash at least.
So 0.7.3
import TextEmail from "..\..\emails/TextEmail"
;0.7.7-next-0
import TextEmail from "..\..\emails\TextEmail";
if you want to add some detail on how to setup turborepo to #178 that one should be easy to implement