question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

.ts files stopped working

See original GitHub issue

I have a couple of plain typescript files for images and theme tokens. I’m using typescript: true. 0.6.9 was working just fine, but something in 0.7.0 switched to start appending .ts to the variable name. Here’s the syntax error:

import images.ts from "./emails/images.ts";

With this version I can no longer preview, build, or export.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:11

github_iconTop GitHub Comments

2reactions
pstoicacommented, Aug 25, 2022

it’s closer! now the commands seem to have slightly different issues.

build is giving eslint errors. could it be due to my monorepo?

❯ yarn build
yarn run v1.19.0
$ mailing server build
mailing building .mailing...
info  - Checking validity of types  
warn  - The Next.js plugin was not detected in your ESLint configuration. See https://nextjs.org/docs/basic-features/eslint#migrating-existing-config

Failed to compile.

./src/pages/api/render.ts
15:27  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any

./src/pages/index.tsx
1:23  Warning: 'useEffect' is defined but never used.  @typescript-eslint/no-unused-vars
11:7  Error: 'previews' is never reassigned. Use 'const' instead.  prefer-const
26:12  Warning: Fragments should contain more than one child - otherwise, there’s no need for a Fragment at all.  react/jsx-no-useless-fragment
62:19  Warning: The href attribute is required for an anchor to be keyboard accessible. Provide a valid, navigable address as the href value. If you cannot provide an href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/HEAD/docs/rules/anchor-is-valid.md  jsx-a11y/anchor-is-valid
71:11  Warning: The href attribute is required for an anchor to be keyboard accessible. Provide a valid, navigable address as the href value. If you cannot provide an href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/HEAD/docs/rules/anchor-is-valid.md  jsx-a11y/anchor-is-valid

./src/pages/previews/[previewClass]/[previewFunction].tsx
1:30  Warning: 'useEffect' is defined but never used.  @typescript-eslint/no-unused-vars
6:26  Warning: 'NextPage' is defined but never used.  @typescript-eslint/no-unused-vars
66:12  Warning: Fragments should contain more than one child - otherwise, there’s no need for a Fragment at all.  react/jsx-no-useless-fragment

./src/components/Header.tsx
31:11  Warning: The href attribute is required for an anchor to be keyboard accessible. Provide a valid, navigable address as the href value. If you cannot provide an href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/HEAD/docs/rules/anchor-is-valid.md  jsx-a11y/anchor-is-valid

./src/components/HotIFrame.tsx
27:11  Warning: <iframe> elements must have a unique title property.  jsx-a11y/iframe-has-title

./src/components/Intercept.tsx
13:12  Warning: Fragments should contain more than one child - otherwise, there’s no need for a Fragment at all.  react/jsx-no-useless-fragment

./src/components/PreviewSender.tsx
54:20  Warning: Fragments should contain more than one child - otherwise, there’s no need for a Fragment at all.  react/jsx-no-useless-fragment

./src/components/hooks/usePreviewHotkeys.tsx
18:64  Error: Missing semicolon.  semi

info  - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
mailing server [subcommand]

build and start the mailing server

Options:
  --version     Show version number                     [boolean]
  --help        Show help                               [boolean]
  --subcommand  'build' or 'start', blank does both
  --emails-dir  the directory to look for your email templates in
                                        [default: "./src/emails"]
  --port        what port to start the preview server on
                                                  [default: 3883]
  --quiet                              [boolean] [default: false]

Error: Command failed: npx next build .mailing
    at checkExecSyncError (child_process.js:640:11)
    at Object.execSync (child_process.js:676:15)
    at _callee$ (/Users/patrick/puzzle/frontend/node_modules/mailing/dist/mailing.cjs.dev.js:1662:29)
    at tryCatch (/Users/patrick/puzzle/frontend/node_modules/mailing/dist/mailing.cjs.dev.js:134:17)
    at Generator._invoke (/Users/patrick/puzzle/frontend/node_modules/mailing/dist/mailing.cjs.dev.js:114:24)
    at Generator.next (/Users/patrick/puzzle/frontend/node_modules/mailing/dist/mailing.cjs.dev.js:165:21)
    at asyncGeneratorStep (/Users/patrick/puzzle/frontend/node_modules/mailing/dist/mailing.cjs.dev.js:398:24)
    at _next (/Users/patrick/puzzle/frontend/node_modules/mailing/dist/mailing.cjs.dev.js:420:9) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 87383,
  stdout: null,
  stderr: null
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

preview is looping on this:

TypeError: Cannot destructure property 'inAmpMode' of '(0 , _react).useContext(...)' as it is null.
    at Html (webpack-internal:///../../../node_modules/mailing/node_modules/next/dist/pages/_document.js:640:13)
    at renderWithHooks (/Users/patrick/puzzle/frontend/node_modules/react-dom/cjs/react-dom-server-legacy.browser.development.js:5661:16)
    at renderIndeterminateComponent (/Users/patrick/puzzle/frontend/node_modules/react-dom/cjs/react-dom-server-legacy.browser.development.js:5734:15)
    at renderElement (/Users/patrick/puzzle/frontend/node_modules/react-dom/cjs/react-dom-server-legacy.browser.development.js:5949:7)
    at renderNodeDestructiveImpl (/Users/patrick/puzzle/frontend/node_modules/react-dom/cjs/react-dom-server-legacy.browser.development.js:6107:11)
    at renderNodeDestructive (/Users/patrick/puzzle/frontend/node_modules/react-dom/cjs/react-dom-server-legacy.browser.development.js:6079:14)
    at renderIndeterminateComponent (/Users/patrick/puzzle/frontend/node_modules/react-dom/cjs/react-dom-server-legacy.browser.development.js:5788:7)
    at renderElement (/Users/patrick/puzzle/frontend/node_modules/react-dom/cjs/react-dom-server-legacy.browser.development.js:5949:7)
    at renderNodeDestructiveImpl (/Users/patrick/puzzle/frontend/node_modules/react-dom/cjs/react-dom-server-legacy.browser.development.js:6107:11)
    at renderNodeDestructive (/Users/patrick/puzzle/frontend/node_modules/react-dom/cjs/react-dom-server-legacy.browser.development.js:6079:14)

and export-previews is still doing:

Error: previewServerConfig is undefined
    at getConfig (/Users/patrick/puzzle/frontend/node_modules/mailing/dist/mailing.cjs.dev.js:505:11)
    at log (/Users/patrick/puzzle/frontend/node_modules/mailing/dist/mailing.cjs.dev.js:516:7)
    at _callee2$ (/Users/patrick/puzzle/frontend/node_modules/mailing/dist/mailing.cjs.dev.js:1520:13)
    at tryCatch (/Users/patrick/puzzle/frontend/node_modules/mailing/dist/mailing.cjs.dev.js:134:17)
    at Generator._invoke (/Users/patrick/puzzle/frontend/node_modules/mailing/dist/mailing.cjs.dev.js:114:24)
    at Generator.next (/Users/patrick/puzzle/frontend/node_modules/mailing/dist/mailing.cjs.dev.js:165:21)
    at asyncGeneratorStep (/Users/patrick/puzzle/frontend/node_modules/mailing/dist/mailing.cjs.dev.js:398:24)
    at _next (/Users/patrick/puzzle/frontend/node_modules/mailing/dist/mailing.cjs.dev.js:420:9)
    at /Users/patrick/puzzle/frontend/node_modules/mailing/dist/mailing.cjs.dev.js:427:7
    at new Promise (<anonymous>)
1reaction
psugiharacommented, Aug 25, 2022

release in 0.7.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript *.ts not working? - Stack Overflow
It will compile all .ts files into .js files. ... I faced the same problem, try this command: tsc --outFile file.js file.ts.
Read more >
TypeScript editor crashes on opening any .ts file
The TypeScript editor crashes on opening any .ts file and falls back to the basic text editor (https://developercommunity.visualstudio.com/content/problem/41346 ...
Read more >
Windows 10 "hanging" when selecting large .ts (transport
Select a large TS file and the system hangs, the spinning circle icon appears, widow dims white, "(not responding)" displayed in the window ......
Read more >
[Solved] Problem with .ts files - XDA Forums
Hi there, i'm having a problem with playing .ts file on my note 2.. although i can play it with mx player, but...
Read more >
Tsconfig show typescript file not found error after moving it to ...
Issue Type: Bug When I move a typescript file from a directory into another directory or delete the file from vscode, it shows...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found