Nuxt js has strange way of the rebuilding after deployment. On rebuilding the website is not avialable for several minutes, and i'm searching the best way to run this process at the background without reloading.
Is there any solutions?
Build nuxt.js to another directory then that containing your website.
When build is complete replace old website files with new build (you can write simple bash script for this).
Related
Some things to know:
I understand how to make a HTML / CSS / JS website.
I understand how to make a Node JS app and host it on Heroku
I encountered a problem that was very confusing and I still working it out. I am making a firebase project using their latest tree-shaking V9 SDK
import { initializeApp } from 'firebase/app';
I understand Node JS is meant for backend (it can't be run in a browser) so how am I supposed to "build" this into something that I can reference in a script tag? I've heard of webpack but that requires you to run npm run build so how is that practical in any way? That would mean every change I make I would have to build it?
Developer Testing:
How would one live preview this Node JS app on a localhost if Node JS can't be run in a browser? I would live to be able to preview this Node JS app and quickly make changes if that's possible.
I've heard of webpack but that requires you to run npm run build so how is that practical in any way? That would mean every change I make I would have to build it?
Yes, that's the general idea. You make changes to script files on your local machine (or network), and then in order to see the changes take effect, you rebuild the app so that a new bundle is generated. This bundle can then be hosted on your web server or development server, and once it's there, you can refresh the page to see the differences.
But almost all of this can be automated, resulting in it not really being much of a chore at all.
Nodemon is a popular tool that watches a directory for changes and can run Node scripts when a change is detected. With it, you could, for example, make a change to a file, and then it'll automatically rebuild your app.
For Webpack in particular, there's webpack-dev-server, which can automatically refresh a page when the app gets rebuilt.
So, during development, the workflow can be as simple as - make a change, then alt-tab to your browser (hosting the app on localhost) to look at the changes.
Bundles built for the purpose of eventually hosting them on the front-end can easily incorporate Node modules - the build process can take the code from the module, and the bundle produced can include that code. This sort of thing is extraordinarily common.
I have this React JS application to which critical patches are being pushed every now and then and I cannot ask my users to do a hard refresh every time. The current method I'm using to bust the cache and reload from the server is I build the app and then manually go to the index.html and append "?v=number". Also I see several chunks of js being generated, I'm assuming all of them are cached too.
Is there a more elegant solution to automate this process and get the js files from server ONLY when there is a new build?
I'm using react-scripts to build my project.
Quoting from this article:
https://dev.to/flexdinesh/cache-busting-a-react-app-22lk
TL;DR - SemVer your app and generate a meta.json file on each build
that won't be cached by the browser. Invalidate cache and hard reload
the app when there's a version mismatch.
And you can use this npm package to manage your meta.json:
https://www.npmjs.com/package/react-clear-cache
I want to write a script with these requirements:
Can be added using a <script> tag to a web page
Uses NPM packages
Easy to build for production
It will invoke a function doSomething() on being loaded
In the past I've only created full front end or full back end apps using javascript, never a library like this. Is there a specific standard for this? I don't need to deploy to NPM. I just need to be able to run yarn build or something and have it be compressed to a file that I can then deploy and link to.
I've got two projects which I've created:
A web UI built using webpack
A Vert.x webserver written in java built using Gradle
I want to find a way to bring the resulting build dir contents of the first project into the second as the webroot which will be server up using the StaticHandler.
Is anyone aware of a clean way to do this? I want to preserve the two git projects as they are because I like using the webpack dev server for development of the UI and it generally feels cleaner to have them separated.
I was looking at potentially using the bitbucket pipelines build on my repo, however bringing the assets generated by the first project into the build of the second is where I'm facing issues.
You could create a gradle task that before that depends on the jar task (so it runs before it) executes webpack compile into the resources directory. So when your jar task runs it bundles the compiled webpack code.
Is there a way to load JavaScript files from jars when running tests with js-test-driver? I'd like to find a solution that works both from command line and from Eclipse.
The reason I want to solve this is that I'm trying to do a gradle build and store artifacts on a repository. The artifacts (jars) contain Java as well as JavaScript files, and when running the JavaScript unit tests with js-test-driver, I have dependencies to JavaScript files inside the jars.
One solution is to unpack the jars and run js-test-driver normally. Is there a better solution without the unpacking?