-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbuild.config.ts
More file actions
23 lines (22 loc) · 1.08 KB
/
build.config.ts
File metadata and controls
23 lines (22 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { defineBuildConfig } from "unbuild";
export default defineBuildConfig({
entries: ["src/index"],
declaration: true,
externals: [/^(?:@playwright\/test|playwright|playwright-core)(?:\/.*)?$/, "@shopware/api-client", "@axe-core/playwright", "axe-html-reporter", "axe-core", "image-js", "uuid"],
hooks: {
"rollup:dts:options": (_ctx, options) => {
// The DTS bundler follows @playwright/test's re-export chain
// (export * from 'playwright/test') and emits the resolved
// specifier for namespace imports. Consumers don't have the
// unscoped `playwright` package, so rewrite it back.
const plugins = Array.isArray(options.plugins) ? options.plugins : options.plugins ? [options.plugins] : [];
plugins.push({
name: "rewrite-playwright-dts-imports",
renderChunk(code: string) {
return code.replace(/from ['"]playwright\/test['"]/g, "from '@playwright/test'");
},
});
options.plugins = plugins;
},
},
});