"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CJSChunkExtractor = void 0;
// Some dependencies think they have access to this variable. Webpack
// has a plugin for adding this to the bundles, however we need to
// add this while using es6 only
const setupEnvVar = (options) => `<script>
window.process = {
  env: {
    NODE_ENV: "${options.mode}"
  }
}
</script>`;
const getModuleImportTag = (options) => `<script type="module-shim">
import "${options.publicPaths.assets}pages/${options.page.name}.js";
</script>`;
// TODO: We should figure out a way to preload the script tags are we require them
class CJSChunkExtractor {
    constructor(options) {
        this.options = options;
        this.chunks = new Set();
        this.addChunk = (chunk) => {
            if (!this.chunks.has(chunk)) {
                this.chunks.add(chunk);
            }
        };
        this.getScriptTags = () => `<script id="__LOADABLE_REQUIRED_CHUNKS__">[]</script>${setupEnvVar(this.options)}${getModuleImportTag(this.options)}<script src="https://unpkg.com/es-module-shims"></script>`; // TODO: Remove this once chrome supports import maps
        this.getStyleTags = () => '';
        this.getLinkTags = () => '';
    }
}
exports.CJSChunkExtractor = CJSChunkExtractor;
