This repository has been archived by the owner on Oct 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 221
web-worker doesn't work with typescript and nextjs #2753
Labels
Type: Bug 🐛
Something isn't working
Comments
This configuration allows dev server to run: import { WebWorkerPlugin } from "@shopify/web-worker/webpack";
/** @type {import('next').NextConfig} */
const nextConfig = {
webpack: (config, { isServer, nextRuntime, dev }) => {
if (!isServer) {
config.plugins.push(
new WebWorkerPlugin({
globalObject: "self",
}),
);
config.module.rules.push({
test: /\.(ts|tsx)/,
exclude: /node_modules/,
use: [{
loader: 'babel-loader',
options: {
babelrc: false,
plugins: ['@shopify/web-worker/babel'],
presets: ["@babel/preset-typescript"]
}
}]
})
}
}
}
export default nextConfig But build still fails:
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Overview
web-worker doesn't work with typescript and nextjs. Suggested
babel-loader
only works with js files.Nextjs uses webpack5 and bunch of own loaders.
Adding
is not enough.
I was able to make it work by modifying webpack config in
next.config
like this:So the appropriate rule looks like this:
But this solution feels flakey.
Consuming repo
https://github.com/Shopify/quilt/tree/main/packages/web-worker
Scope
Is this issue related to a specific package?
Checklist
The text was updated successfully, but these errors were encountered: