Skip to content
Snippets Groups Projects
Commit 9f776e15 authored by Millicent Billette's avatar Millicent Billette
Browse files

FIX: extend compatibility by removing module mention in prod

parent a786a0f4
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,7 @@ build-and-clean: ...@@ -9,6 +9,7 @@ build-and-clean:
- npm install - npm install
- npm run postinstall - npm run postinstall
- npm run build - npm run build
- npm run prod
artifacts: artifacts:
untracked: true untracked: true
paths: paths:
......
...@@ -7,8 +7,4 @@ try{fs.writeFileSync("public/vendors/nacl.js",(fs.readFileSync("public/vendors/n ...@@ -7,8 +7,4 @@ try{fs.writeFileSync("public/vendors/nacl.js",(fs.readFileSync("public/vendors/n
.replace("(function(nacl) {","var nacl = {};") .replace("(function(nacl) {","var nacl = {};")
.replace("})(typeof module !== 'undefined' && module.exports ? module.exports : (self.nacl = self.nacl || {}));","export {nacl};") .replace("})(typeof module !== 'undefined' && module.exports ? module.exports : (self.nacl = self.nacl || {}));","export {nacl};")
,"utf8");} catch (e) {console.error(e);} ,"utf8");} catch (e) {console.error(e);}
// let js = fs.readFileSync("node_modules/jparticles/production/jparticles.js","utf8");
// js += fs.readFileSync("node_modules/jparticles/production/particle.js","utf8");
// js += fs.readFileSync("main.js","utf8");
// fs.writeFileSync("main.js",js,"utf8");
// fs.writeFileSync("index.html",(fs.readFileSync("index.html","utf8")).replace(/(.*node_modules.*)/g,''),"utf8");
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
"scripts": { "scripts": {
"postinstall": "node build.js", "postinstall": "node build.js",
"build": "rollup public/worker.js --format iife --file public/generated.worker.js && rollup public/main.js --format iife --file public/generated.main.js", "build": "rollup public/worker.js --format iife --file public/generated.worker.js && rollup public/main.js --format iife --file public/generated.main.js",
"prod": "node prod.js",
"test": "echo open public/test.html in your browser" "test": "echo open public/test.html in your browser"
}, },
"repository": { "repository": {
......
prod.js 0 → 100644
const fs = require("fs");
change(
`<script type="module" src="main.js"></script>`,
`<script src="generated.main.js"></script>`,
`public/index.html`);
change(
`Worker('generated.worker.js',{type:"module"})`,
`Worker('generated.worker.js')`,
`public/generated.main.js`);
function change(thisString,withThisString,inThisFile) {
try{fs.writeFileSync(inThisFile,(fs.readFileSync(inThisFile,"utf8"))
.replace(thisString,withThisString)
,"utf8");} catch (e) {console.error(e);}
}
...@@ -97,7 +97,6 @@ space::[ _-.]{0,1} ...@@ -97,7 +97,6 @@ space::[ _-.]{0,1}
</style> </style>
</a> </a>
</footer> </footer>
<!--<script type="module" src="main.js"></script>--> <script type="module" src="main.js"></script>
<script src="generated.main.js"></script>
</body> </body>
</html> </html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment