From 5b4baea1d6dd2c2ac98f9ab3c129b4e24ccb02f6 Mon Sep 17 00:00:00 2001 From: Brad Cornes Date: Thu, 7 Oct 2021 12:33:23 +0100 Subject: [PATCH] Use `path.resolve` instead of string concatenation This allows the path to be statically analysed when bundling, for example with `pkg` --- src/corePlugins.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/corePlugins.js b/src/corePlugins.js index 527dabc15..5c16b77ba 100644 --- a/src/corePlugins.js +++ b/src/corePlugins.js @@ -1,4 +1,5 @@ import fs from 'fs' +import path from 'path' import postcss from 'postcss' import createUtilityPlugin from './util/createUtilityPlugin' import buildMediaQuery from './util/buildMediaQuery' @@ -363,7 +364,9 @@ export let variantPlugins = { export let corePlugins = { preflight: ({ addBase }) => { - let preflightStyles = postcss.parse(fs.readFileSync(`${__dirname}/css/preflight.css`, 'utf8')) + let preflightStyles = postcss.parse( + fs.readFileSync(path.resolve(__dirname, 'css/preflight.css'), 'utf8') + ) addBase([ postcss.comment({