MCPcopy
hub / github.com/shadowwalker/next-pwa / buildFallbackWorker

Function buildFallbackWorker

build-fallback-worker.js:57–144  ·  view source on GitHub ↗
({ id, fallbacks, basedir, destdir, minify, pageExtensions })

Source from the content-addressed store, hash-verified

55}
56
57const buildFallbackWorker = ({ id, fallbacks, basedir, destdir, minify, pageExtensions }) => {
58 const envs = getFallbackEnvs({ fallbacks, basedir, id, pageExtensions })
59 if (!envs) return
60
61 const name = `fallback-${id}.js`
62 const fallbackJs = path.join(__dirname, `fallback.js`)
63
64 webpack({
65 mode: 'none',
66 target: 'webworker',
67 entry: {
68 main: fallbackJs
69 },
70 resolve: {
71 extensions: ['.js'],
72 fallback: {
73 module: false,
74 dgram: false,
75 dns: false,
76 path: false,
77 fs: false,
78 os: false,
79 crypto: false,
80 stream: false,
81 http2: false,
82 net: false,
83 tls: false,
84 zlib: false,
85 child_process: false
86 }
87 },
88 module: {
89 rules: [
90 {
91 test: /\.js$/i,
92 use: [
93 {
94 loader: 'babel-loader',
95 options: {
96 presets: [
97 [
98 'next/babel',
99 {
100 'transform-runtime': {
101 corejs: false,
102 helpers: true,
103 regenerator: false,
104 useESModules: true
105 },
106 'preset-env': {
107 modules: false,
108 targets: 'chrome >= 56'
109 }
110 }
111 ]
112 ]
113 }
114 }

Callers 1

webpackFunction · 0.85

Calls 2

getFallbackEnvsFunction · 0.85
webpackFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…