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.

Can't import workbox in typescript tests

See original GitHub issue

Hello, I can’t import worktop in a test because it loads .mjs files and I have no idea how to load .mjs with typescript files. I use node-tap as test runner. Maybe it’s possible to fix it with https://nodejs.org/api/packages.html#packages_conditional_exports

.../node_modules/worktop/request/index.mjs:18
src/routes/foo.test.ts 2> export {
SyntaxError: Unexpected token 'export'

package.json

  "scripts": {
    "test": "tap --ts",
  },

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
lukeedcommented, Apr 19, 2021

Cool, will do 👍 I’m likely to extract this register script into its own package since I’ve needed it a number of times.

0reactions
lukeedcommented, Apr 20, 2021

Yeah, that’s the missing part of the bin/*.js scripts. I don’t have sourcemap support in here yet but it should be fairly straightforward. TBH that’s the missing piece before actually extracting this as a separate module.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Paths mapping between typescript and jest is not working at all
In tested file I have: import { TopBar, Slider, Player, NotLogged, LoadingIndicator, Message } from "components";. And error is. Cannot find ...
Read more >
Building a Service Worker with Workbox 5, TypeScript ...
I won't be explaining how the service worker is integrated into the Angular app; I'll leave that for a later post. If you...
Read more >
Build a progressive web app (PWA) with React - LogRocket Blog
This builds you a React web app built with TypeScript with support for PWA out of the box. It can be tested locally...
Read more >
How to Make your React App a Progressive Web App (PWA)
Explaining the most important concepts around PWAs followed by a step by step tutorial, using Webpack, Workbox and TypeScript.
Read more >
@kanaye/service-worker-webpack-plugin - npm
import workboxPrecaching from 'workbox-precaching'; // import the manifest from the virtual module import resources from '#serviceworker-virtual ...
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