question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"npm run build" is slower than "npm run dev"

See original GitHub issue

Hello, first of all sorry for my English, I use google translate.

When I use “npm run dev”, the translation process is done quickly without any problems, but when I do “npm run build”, the file "php_tr.32683819.js" loads quite late depending on the internet speed. This causes “keys” to appear in the first opening of the page.

resim_2022-09-10_000114141

As seen in the picture, “php_tr.32683819.js” file is loaded 2000ms after the page is opened.

image

Dependencies “laravel-vue-i18n”: “^2.2.2”, “vite”: “^3.0.0”, “vue”: “^3.2.31”

Laravel 9+

vite.config.js
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import vue from '@vitejs/plugin-vue';
import i18n from 'laravel-vue-i18n/vite';


export default defineConfig({

    plugins: [
        laravel({
            input: 'resources/js/app.js',
            refresh: true,
        }),
        vue({
            template: {
                transformAssetUrls: {
                    base: null,
                    includeAbsolute: false,
                },
            },
        }),
        i18n(),
    ],
});

app.js
createInertiaApp({
    title: (title) => `${title} - ${appName}`,
    resolve: (name) => resolvePageComponent(`./Pages/${name}.vue`, import.meta.glob('./Pages/**/*.vue')),
    setup({ el, app, props, plugin }) {
        const captcheKey = props.initialPage.props.recaptcha_site_key;
        const application = createApp({ render: () => h(app, props) })
            .use(plugin)
            .use(i18nVue, {
                resolve: async lang => {
                    const langs = import.meta.glob('../../lang/*.json');
                    return await langs[`../../lang/${lang}.json`]();
                }
            })
    ...

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
xiCO2kcommented, Sep 10, 2022

if you want to make sure it is not a “lazyLoad” you can use the globEager instead.

Check the SSR import suggestion: https://github.com/xiCO2k/laravel-vue-i18n#ssr-server-side-rendering

0reactions
xiCO2kcommented, Sep 10, 2022

no problem anytime.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Npm run build and watch extremely slow - Stack Overflow
I'm trying to create a basic Tailwind starter project and when I try to run the npm run build or npm run watch...
Read more >
npm start build stuff and is too slow · Issue #7684 - GitHub
This basically clean and build the full project and then start it in a dev mode. This command can take forever to run....
Read more >
NPM Install Build Step Becomes Extremely Slow, Remedied ...
We have an NPM step in our build definition, which executes the install command. Our overall build takes 15-20ish minutes.
Read more >
npm run prod is very slow! - Laracasts
Hello , I try to run npm run prod in the server production, but it's very very very slow (sometimes more than 15...
Read more >
npm-run-script
If you try to run a script without having a node_modules directory and it fails, you will be given a warning to run...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found