summaryrefslogtreecommitdiff
path: root/snowpack-plugin.cjs
diff options
context:
space:
mode:
authorGravatar Matthew Phillips <matthew@matthewphillips.info> 2021-03-30 15:06:43 -0400
committerGravatar GitHub <noreply@github.com> 2021-03-30 15:06:43 -0400
commit4a732837cdd1ad5493a25ae58612e9b6a302c651 (patch)
tree724af4f76202d6615a6969cd2d2bd7e3723c3d4f /snowpack-plugin.cjs
parent7334a550d8e042ae0dc59519149df2b3ad04f058 (diff)
downloadastro-4a732837cdd1ad5493a25ae58612e9b6a302c651.tar.gz
astro-4a732837cdd1ad5493a25ae58612e9b6a302c651.tar.zst
astro-4a732837cdd1ad5493a25ae58612e9b6a302c651.zip
Resolve component URLs during compilation (#40)
Previously dynamic component URLs were being resolved client-side in a weird way that only worked during dev. This change makes them handle during compilation, so it works in both (and improves readability of the dynamic import output).
Diffstat (limited to '')
-rw-r--r--snowpack-plugin.cjs3
1 files changed, 2 insertions, 1 deletions
diff --git a/snowpack-plugin.cjs b/snowpack-plugin.cjs
index f4f2edb81..dcb714ea6 100644
--- a/snowpack-plugin.cjs
+++ b/snowpack-plugin.cjs
@@ -3,7 +3,7 @@ const { readFile } = require('fs').promises;
// Snowpack plugins must be CommonJS :(
const transformPromise = import('./lib/compiler/index.js');
-module.exports = function (snowpackConfig, { resolve, extensions } = {}) {
+module.exports = function (snowpackConfig, { resolve, extensions, astroConfig } = {}) {
return {
name: 'snowpack-astro',
knownEntrypoints: ['deepmerge'],
@@ -16,6 +16,7 @@ module.exports = function (snowpackConfig, { resolve, extensions } = {}) {
const projectRoot = snowpackConfig.root;
const contents = await readFile(filePath, 'utf-8');
const compileOptions = {
+ astroConfig,
resolve,
extensions,
};