Skip to content

source-map build dependency breaks when fetch() is polyfilled #2712

Closed
@mfbx9da4

Description

@mfbx9da4

Library Affected:
workbox-webpack-plugin

Issue or Feature Request Description:
When combining source maps with webpack and workbox I get the following error at build time.

> next build

info  - Creating an optimized production build  
Failed to compile.

You must provide the URL of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer


> Build error occurred
Error: > Build failed because of webpack errors
    at /Users/DavidAdler/code/with-typescript-app/node_modules/next/dist/build/index.js:15:918
    at async /Users/DavidAdler/code/with-typescript-app/node_modules/next/dist/build/tracer.js:1:525

My nextjs webpack config looks like so

const { InjectManifest } = require('workbox-webpack-plugin')
const withSourceMaps = require('@zeit/next-source-maps')

module.exports = withSourceMaps({
  webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
    config.plugins.push(
      new InjectManifest({
        swSrc: './sw.js',
      })
    )
    return config
  },
})

A minimal failing example can be found here

To recreate run npm run build (after cloning and npm install)

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugAn issue with our existing, production codebase.workbox-build

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions