Unverified Commit d14df6cc authored by Sebastian "Sebbie" Silbermann's avatar Sebastian "Sebbie" Silbermann Committed by GitHub

Use relative sources in `require()` instead of `next/dist/` if possible (#80054)

Makes it easier to get types for those previously untyped `require` calls.
parent 7d3e330a
...@@ -305,7 +305,8 @@ export async function LightningCssLoader( ...@@ -305,7 +305,8 @@ export async function LightningCssLoader(
), ),
}) })
} }
const { loadBindings } = require('next/dist/build/swc') const { loadBindings } =
require('../../../../../build/swc') as typeof import('../../../../../build/swc')
const transform = const transform =
implementation?.transformCss ?? implementation?.transformCss ??
......
...@@ -66,7 +66,8 @@ export class LightningCssMinifyPlugin { ...@@ -66,7 +66,8 @@ export class LightningCssMinifyPlugin {
} = compilation.compiler } = compilation.compiler
if (!this.transform) { if (!this.transform) {
const { loadBindings } = require('next/dist/build/swc') const { loadBindings } =
require('../../../../../build/swc') as typeof import('../../../../../build/swc')
this.transform = (await loadBindings()).css.lightning.transform this.transform = (await loadBindings()).css.lightning.transform
} }
......
...@@ -1370,7 +1370,8 @@ export default async function loadConfig( ...@@ -1370,7 +1370,8 @@ export default async function loadConfig(
} }
if (userConfig.experimental?.useLightningcss) { if (userConfig.experimental?.useLightningcss) {
const { loadBindings } = require('next/dist/build/swc') const { loadBindings } =
require('../build/swc') as typeof import('../build/swc')
const isLightningSupported = (await loadBindings())?.css?.lightning const isLightningSupported = (await loadBindings())?.css?.lightning
if (!isLightningSupported) { if (!isLightningSupported) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment