Home

Issue: 3147

Nuxt generate failed. no html files in dist dir

[issue link]

when I run nuxt generate, this is no html files in my dist dir and no error printed out. I try to figure out what’s the problem, then I find this.bundleRenderer.renderToString(context) run failed but I don’t know why…Please help me…


const pkg = require('./package');
const nodePort = process.env.NODE_PORT || 8870;
const nginxPort = process.env.NGINX_PORT || 8898;
const path = require('path');
const baseUrl = '/store-alpha';

module.exports = {
    // https://nuxtjs.org/api/configuration-loading
    loading: false,

    progress: false,

    env: {
        baseUrl: baseUrl
    },

    router: {
        extendRoutes(routes, resolve) {
            routes.push({
                name: 'overviewAlias',
                path: '/',
                component: resolve(__dirname, 'pages/overview.vue')
            });
        },
        base: baseUrl
    },
    /*
     ** Headers of the page
     */
    head: {
        title: pkg.name,
        meta: [{
                charset: 'utf-8'
            },
            {
                name: 'viewport',
                content: 'width=device-width, initial-scale=1'
            },
            {
                hid: 'description',
                name: 'description',
                content: pkg.description
            },
            {
                hid: 'keywords',
                name: 'keywords',
                content: pkg.keywords
            }
        ],
        link: [{
            rel: 'icon',
            type: 'image/x-icon',
            href: `${baseUrl}/favicon.ico`
        }],
        __dangerouslyDisableSanitizers: ['script'],
        script: [{
            innerHTML: `
                var _hmt = _hmt || [];
                (function() {
                var hm = document.createElement("script");
                hm.src = "https://hm.baidu.com/hm.js";
                var s = document.getElementsByTagName("script")[0];
                s.parentNode.insertBefore(hm, s);
                })();
            `,
            type: 'text/javascript'
        }]
    },


    /*
     ** Global CSS
     */
    css: [
        'swiper/dist/css/swiper.css',
        'normalize.css/normalize.css',
        '~/css/main.css'
    ],

    /*
     ** Plugins to load before mounting the App
     */
    plugins: [
        {src: '~/plugins/vue-swiper.js', ssr: false},
        {src: '~/plugins/vue-mixin.js'},
        {src: '~/plugins/axios'}
    ],

    /*
     ** Nuxt.js modules
     */
    modules: [
        '@nuxtjs/axios'
        // Doc: https://github.com/nuxt-community/axios-module#usage
    ],

    /*
     ** Axios module configuration
     */
    axios: {
        prefix: `${baseUrl}/api`,
        browserBaseURL: `${baseUrl}/api`,
        port: process.env.NODE_ENV === 'development' ? nodePort : nginxPort,
        progress: false
        // See https://github.com/nuxt-community/axios-module#options
    },

    /*
     ** Build configuration
     */
    build: {
        extractCSS: true,
        vendor: [
            'vue-awesome-swiper',
            'axios'
        ],
        /*
         ** You can extend webpack config here
         */
        extend(config, ctx) {
            const vueLoader = config.module.rules.find(rule => rule.loader === 'vue-loader');

            vueLoader.options.loaders.less.push({
                loader: 'sass-resources-loader',
                options: {
                    resources: [
                        path.resolve(__dirname, './css/variable.less'),
                        path.resolve(__dirname, './css/mixin.less')
                    ]
                }
            });

            if (ctx.isClient) {
                config.entry.vendor.unshift('babel-polyfill');
            }

            // for (let i of config.plugins) {
            // }
        }
    }
};

15:51:48 › npm run generate

> AI-Store@1.0.0 generate
> nuxt generate

  nuxt:generate Generating... +0ms
  nuxt:axios BaseURL: http://localhost:8898/store-alpha/api (Browser: /store-alpha/api) +0ms
  nuxt:build App root: /Users/leo/workspace/XXXai-store +0ms
  nuxt:build Generating /Users/leo/workspace/XXXXai-store/.nuxt files... +1ms
  nuxt:build Generating files... +37ms
  nuxt:build Generating routes... +16ms
  nuxt:build Building files... +35ms
  ████████████████████ 100%

Build completed in 27.81s



 WARNING  Compiled with 1 warnings                                                          15:55:51

 warning

asset size limit: The following asset(s) exceed the recommended size limit (300 kB).
This can impact web performance.
Assets:
  img/hardware-bg.1caa731.png (452 kB)
  img/register-banner.47765b7.png (1.19 MB)
  img/solution-bg.0ad18d6.png (329 kB)
  img/software-bg.b582cf3.png (335 kB)
  vendor.fc97419c91f170146d85.js (689 kB)

Hash: 6b29a811777b792c3dcd
Version: webpack 3.10.0
Time: 27813ms
                                                Asset       Size  Chunks                    Chunk Names
                                 img/logo.30ff416.png    8.13 kB          [emitted]
                              img/menu-bg.7a1e4d0.png    90.8 kB          [emitted]
                   img/activity-news-icon.0e455a5.png    16.2 kB          [emitted]
                     img/online-news-icon.f812a9a.png      16 kB          [emitted]
                        img/hardware-icon.bf83e3a.png    16.4 kB          [emitted]
                        img/software-icon.729e6ea.png    15.8 kB          [emitted]
                          img/hardware-bg.1caa731.png     452 kB          [emitted]  [big]
                             img/next-btn.b8475dc.png     1.1 kB          [emitted]
                      img/register-banner.47765b7.png    1.19 MB          [emitted]  [big]
                       img/info-news-icon.22484f7.png    16.3 kB          [emitted]
                        img/solution-icon.60c5ad8.png    16.1 kB          [emitted]
                     img/prev-btn-disable.9adab35.png    1.15 kB          [emitted]
                             img/prev-btn.b50d43b.png    1.16 kB          [emitted]
                          img/solution-bg.0ad18d6.png     329 kB          [emitted]  [big]
                     img/next-btn-disable.51c837e.png    1.19 kB          [emitted]
                           img/site-error.a3065ec.png    7.56 kB          [emitted]
                          img/software-bg.b582cf3.png     335 kB          [emitted]  [big]
pages/provider/register/index.7205ad77270185e3d68b.js     234 kB       0  [emitted]         pages/provider/register/index
         pages/product/search.b8176473e548e28bb608.js    21.6 kB       1  [emitted]         pages/product/search
               pages/overview.5b134375f1713083a257.js     107 kB       2  [emitted]         pages/overview
         pages/provider/index.377eb77e59a950729b1f.js    17.7 kB       3  [emitted]         pages/provider/index
          pages/product/index.12e49d482ae8a38d6c01.js    11.6 kB       4  [emitted]         pages/product/index
              layouts/default.7584f11afa15a8893d53.js  817 bytes       5  [emitted]         layouts/default
                   pages/test.85419dc950182fa91a2e.js  406 bytes       6  [emitted]         pages/test
                    pages/404.ef4837d2a4db5125c3b0.js  404 bytes       7  [emitted]         pages/404
                       vendor.fc97419c91f170146d85.js     689 kB       8  [emitted]  [big]  vendor
                          app.7f4adc70dc94248fa94e.js    59.8 kB       9  [emitted]         app
                     manifest.6b29a811777b792c3dcd.js    1.84 kB      10  [emitted]         manifest
             app.cf337f816b26e01b2f73cc2d1f648624.css    35.7 kB       9  [emitted]         app
                                             LICENSES    2.81 kB          [emitted]
 + 3 hidden assets

WARNING in asset size limit: The following asset(s) exceed the recommended size limit (300 kB).
This can impact web performance.
Assets:
  img/hardware-bg.1caa731.png (452 kB)
  img/register-banner.47765b7.png (1.19 MB)
  img/solution-bg.0ad18d6.png (329 kB)
  img/software-bg.b582cf3.png (335 kB)
  vendor.fc97419c91f170146d85.js (689 kB)
Hash: 359849294a2855e4c0ea
Version: webpack 3.10.0
Time: 3707ms
             Asset    Size  Chunks             Chunk Names
server-bundle.json  526 kB          [emitted]
  nuxt: Call generate:distRemoved hooks (1) +0ms
  nuxt:generate Destination folder cleaned +33s
  nuxt: Call generate:distCopied hooks (1) +37ms
  nuxt:generate Static & build files copied +37ms
  nuxt:render Rendering url /test +0ms
  nuxt:render Rendering url /provider +150ms
  nuxt:render Rendering url /product +3ms
  nuxt:render Rendering url /404 +2ms
  nuxt:render Rendering url /overview +1ms
  nuxt:render Rendering url /product/search +4ms
  nuxt:render Rendering url /provider/register +4ms
  nuxt:render Rendering url / +8ms
This question is available on Nuxt.js community (#c6792)