angular/packages/service-worker/cli/esbuild.config.js
Paul Gschwendtner e60058c88a build: update service-worker package to export worker script and schema (#43431)
Updates the service-worker package to export the worker script and
schema, so that these files can be resolved and included by consumers.

Additionally, the CLI bundle is updated to be using ESM as it
transitively relies on the `core` entry-point of the package which
already uses ESM. Also this is required because the script is part
of the the service-worker package which has `type: module` applied.

PR Close #43431
2021-10-01 18:28:44 +00:00

21 lines
668 B
JavaScript

/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
module.exports = {
resolveExtensions: ['.mjs'],
// Note: `@bazel/esbuild` has a bug and does not pass-through the format from Starlark.
format: 'esm',
banner: {
// Workaround for: https://github.com/evanw/esbuild/issues/946
// TODO: Remove this workaround in the future once devmode is ESM as well.
js: `
import {createRequire as __cjsCompatRequire} from 'module';
const require = __cjsCompatRequire(import.meta.url);
`,
},
};