@teambit/ui 0.0.1068 → 0.0.1070

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -136,33 +136,29 @@ export function devConfig(workspaceDir, entryFiles, title): WebpackConfigWithDev
136
136
  },
137
137
  },
138
138
 
139
- onBeforeSetupMiddleware(wds) {
140
- const { app } = wds;
139
+ setupMiddlewares: (middlewares, devServer) => {
140
+ if (!devServer) {
141
+ throw new Error('webpack-dev-server is not defined');
142
+ }
143
+
141
144
  // Keep `evalSourceMapMiddleware` and `errorOverlayMiddleware`
142
145
  // middlewares before `redirectServedPath` otherwise will not have any effect
143
146
  // This lets us fetch source contents from webpack for the error overlay
144
- // @ts-ignore @types/wds mismatch
145
- app.use(evalSourceMapMiddleware(wds));
146
- // This lets us open files from the runtime error overlay.
147
- // @ts-ignore
148
- app.use(errorOverlayMiddleware());
149
- },
150
-
151
- onAfterSetupMiddleware(wds) {
152
- // @ts-ignore
153
- const { app } = wds;
154
-
155
- // Redirect to `PUBLIC_URL` or `homepage` from `package.json` if url not match
156
- // @ts-ignore
157
- app.use(redirectServedPath(publicUrlOrPath));
158
-
159
- // This service worker file is effectively a 'no-op' that will reset any
160
- // previous service worker registered for the same host:port combination.
161
- // We do this in development to avoid hitting the production cache if
162
- // it used the same host and port.
163
- // https://github.com/facebook/create-react-app/issues/2272#issuecomment-302832432
164
- // @ts-ignore
165
- app.use(noopServiceWorkerMiddleware(publicUrlOrPath));
147
+ middlewares.push(
148
+ // @ts-ignore @types/wds mismatch
149
+ evalSourceMapMiddleware(devServer),
150
+ // This lets us open files from the runtime error overlay.
151
+ errorOverlayMiddleware(),
152
+ // Redirect to `PUBLIC_URL` or `homepage` from `package.json` if url not match
153
+ redirectServedPath(publicUrlOrPath),
154
+ // This service worker file is effectively a 'no-op' that will reset any
155
+ // previous service worker registered for the same host:port combination.
156
+ // We do this in development to avoid hitting the production cache if
157
+ // it used the same host and port.
158
+ // https://github.com/facebook/create-react-app/issues/2272#issuecomment-302832432
159
+ noopServiceWorkerMiddleware(publicUrlOrPath)
160
+ );
161
+ return middlewares;
166
162
  },
167
163
 
168
164
  devMiddleware: {
Binary file