From 09112272accd1bf200efd2453cf71c99924562c8 Mon Sep 17 00:00:00 2001 From: Steven Date: Tue, 27 Jun 2023 21:01:28 -0400 Subject: [PATCH] Fix import --- .../webpack/plugins/image-loaderfile-plugin.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/next/src/build/webpack/plugins/image-loaderfile-plugin.ts b/packages/next/src/build/webpack/plugins/image-loaderfile-plugin.ts index 52bb2f73905dd..8840bc6f716b6 100644 --- a/packages/next/src/build/webpack/plugins/image-loaderfile-plugin.ts +++ b/packages/next/src/build/webpack/plugins/image-loaderfile-plugin.ts @@ -1,9 +1,9 @@ -import type { webpack } from 'next/dist/compiled/webpack/webpack' -import { getBaseSWCOptions } from 'next/src/build/swc/options' import { readFileSync, writeFileSync, copyFileSync } from 'fs' import { dirname, join } from 'path' -import { transform } from '../../swc' +import type { webpack } from 'next/dist/compiled/webpack/webpack' import type { NextConfigComplete } from '../../../server/config-shared' +import { getBaseSWCOptions } from '../../swc/options' +import { transform } from '../../swc' export class ImageLoaderFilePlugin { opts: { dev: boolean; config: NextConfigComplete } @@ -40,7 +40,12 @@ export class ImageLoaderFilePlugin { jsConfig: {}, }) - const result = await transform(source, swcOpts) + const result = await transform(source, { + ...swcOpts, + module: { + type: 'commonjs', + }, + }) console.log('result from swc is', result)