Skip to content
Discussion options

You must be logged in to vote

Possibly:

// src/_data/site.js
const DEFAULT_PORT = process.env.PORT || (process.env.URL && new URL(process.env.URL).port) || 8000;

module.exports = {
  url: process.env.URL || `http://localhost:${DEFAULT_PORT}`,
  port: DEFAULT_PORT,
};
// .eleventy.js
const { port } = require("./src/_data/site");

/**
 * @typedef {import('@11ty/eleventy/src/UserConfig')} EleventyConfig
 * @typedef {ReturnType<import('@11ty/eleventy/src/defaultConfig')>} EleventyReturnValue
 * @type {(eleventyConfig: EleventyConfig) => EleventyReturnValue}
 */
module.exports = function (eleventyConfig) {
  eleventyConfig.setServerOptions({ port });
  console.log(eleventyConfig.serverOptions);

  return {
    dir: {
      

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ed-ponce
Comment options

Answer selected by ed-ponce
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants