Skip to content Skip to sidebar Skip to footer

How To Import Extremely Long Javascript Const Into An Html File

I have a JavaScript const that is a couple thousand lines long. When I include this constant, which is an array of objects, directly inside the tags in my index.html file, the con

Solution 1:

Inside your HTML:

<scripttype="module">import longJSON from'./longJSON.js';
    console.log(longJSON);
</script

The longJSON.js

exportdefault {
    some: 'super fancy content'
};

Information about modules: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules

with best regards

Post a Comment for "How To Import Extremely Long Javascript Const Into An Html File"