Есть активы / страницы / и т. Д. предполагается вручную связать для производства в Nuxt 2? - PullRequest
0 голосов
/ 27 марта 2019

Я недавно обновился с Nuxt 1.4 до 2.5. Процесс производственной сборки, кажется, не совсем одинаков, по крайней мере, для моей установки, где я архивирую все для развертывания на Elastic Beanstalk. Пока я заставляю его работать, мне интересно, сделал ли я что-то неэффективное.

Я строил производство для развертывания на ElasticBeanstalk через npm run build && gulp bundle:ebs. сценарий сборки nuxt build && backpack build. сценарий глотка

    const path = require('path');
    const zip = require('gulp-zip');
    const rename = require('gulp-rename');

    let basename = path.basename(process.cwd());
    let renameExpression = new RegExp('^' + basename);

    return gulp.src([
    '.ebextensions/**',
    '.nuxt/**',
    'apollo/**',
    'build/**',
    'config/!(local).json',
    'fixtures/**',
    '.babelrc',
    '.npmrc',
    'package.json',
    'server.js'
    ], {
        nodir: true,
    dot: true,
        base: '.'
    })
        .pipe(rename(function(path) {
            path.dirname = path.dirname.replace(renameExpression, pkg.name);

            return path;
        }))
        .pipe(zip(pkg.name + '-ebs-' + pkg.version + '.zip'))
        .pipe(gulp.dest('dist'));

Когда я запускаю приложение через node build/main.js, я получаю следующее предупреждение: WARN No pages directory found in /home/<path-to-app>. Using the default built-in page., а затем, когда запускается построитель Nuxt, он выдает (node:26131) UnhandledPromiseRejectionWarning: Error: Could not compile template /home/<path-to-app>/node_modules/@nuxt/vue-app/template/App.js: Cannot resolve "@/assets/scss/site.scss" from "/home/<path-to-app>/assets/scss/site.scss".

Соответствующие части моего nuxt.config.js выглядят так:

modules: [
        '@nuxtjs/apollo',
        '@nuxtjs/google-analytics',
        '@nuxtjs/style-resources',
        [
            '@nuxtjs/pwa',
            {
                icon: false,
                meta: false,
                onesignal: false
            }
        ],
        'cookie-universal-nuxt'
    ],

    styleResources: {
        scss: [
            '~assets/scss/lifescope-styles/*.scss',
            '~assets/scss/lifescope-styles/*/*.scss',
        ]
    },

    css: [
        {
            src: '~assets/scss/site.scss',
            lang: 'scss'
        }
    ],

и вот зависимости в package.json:

"devDependencies": {
    "babel-eslint": "^10.0.1",
    "babel-jest": "^24.5.0",
    "backpack-core": "^0.8.3",
    "eslint": "^4.18.0",
    "eslint-config-prettier": "^2.9.0",
    "eslint-plugin-import": "^2.16.0",
    "eslint-plugin-prettier": "^2.6.0",
    "expose-loader": "^0.7.5",
    "flow-bin": "0.65.0",
    "gulp": "^3.9.1",
    "gulp-add-src": "^1.0.0",
    "gulp-babel": "^7.0.1",
    "gulp-clean": "^0.4.0",
    "gulp-clean-css": "^3.9.4",
    "gulp-concat": "^2.6.1",
    "gulp-eslint": "^4.0.2",
    "gulp-gzip": "^1.4.2",
    "gulp-header": "^2.0.5",
    "gulp-jsonlint": "^1.2.1",
    "gulp-less": "^3.5.0",
    "gulp-lesshint": "^5.0.2",
    "gulp-rename": "^1.2.3",
    "gulp-tar": "^2.1.0",
    "gulp-uglify": "^3.0.0",
    "gulp-util": "^3.0.8",
    "gulp-zip": "^4.1.0",
    "jest": "^22.3.0",
    "mongodb-memory-server": "^1.7.0",
    "nodemon": "^1.18.10",
    "path": "^0.12.7",
    "prettier": "^1.10.2",
    "request": "^2.83.0",
    "run-sequence": "^2.2.1",
    "webrtc-adapter": "^6.2.1"
  },
  "dependencies": {
    "@babel/cli": "^7.2.3",
    "@babel/core": "^7.4.0",
    "@babel/node": "^7.2.2",
    "@babel/plugin-proposal-object-rest-spread": "^7.4.0",
    "@babel/plugin-syntax-dynamic-import": "^7.2.0",
    "@babel/plugin-transform-flow-strip-types": "^7.4.0",
    "@babel/plugin-transform-modules-amd": "^7.2.0",
    "@babel/plugin-transform-runtime": "^7.4.0",
    "@babel/preset-env": "^7.4.2",
    "@babel/preset-stage-2": "^7.0.0",
    "@mapbox/mapbox-gl-draw": "^1.1.1",
    "@nuxtjs/apollo": "^4.0.0-rc4",
    "@nuxtjs/google-analytics": "^2.2.0",
    "@nuxtjs/pwa": "^3.0.0-beta.14",
    "@nuxtjs/style-resources": "^0.1.2",
    "acorn": "^6.1.1",
    "aframe": "^0.8.2",
    "aframe-animation-component": "^4.2.0",
    "aframe-asset-on-demand-component": "^1.0.3",
    "aframe-extras": "^4.1.2",
    "aframe-geojson-component": "^1.2.6",
    "aframe-gui": "git+https://git@github.com/lifescopelabs/aframe-gui",
    "aframe-input-mapping-component": "^0.1.3",
    "aframe-layout-component": "^4.3.1",
    "aframe-src-fit-component": "git+https://git@github.com/lifescopelabs/aframe-src-fit-component",
    "aframe-teleport-controls": "^0.3.1",
    "apollo-cache-inmemory": "^1.5.1",
    "apollo-client": "^2.5.1",
    "apollo-link": "^1.2.11",
    "apollo-link-http": "^1.5.14",
    "apollo-link-ws": "^1.0.8",
    "async": "^2.6.0",
    "aws-sdk": "^2.250.1",
    "axios": "^0.18.0",
    "bitscoop-sdk": "^0.2.0",
    "bootstrap": "^3.3.7",
    "bowser": "^1.9.3",
    "config": "^3.0.1",
    "cookie-parser": "^1.4.3",
    "cookie-universal-nuxt": "^2.0.5",
    "cors": "^2.8.4",
    "cross-env": "^5.1.5",
    "csrf": "^3.0.6",
    "debug": "^3.1.0",
    "easyrtc": "^1.1.0",
    "eonasdan-bootstrap-datetimepicker": "^4.17.47",
    "express": "^4.16.3",
    "glob": "^7.1.2",
    "graphql": "^14.1.1",
    "graphql-tag": "^2.10.1",
    "history": "^4.9.0",
    "http-errors": "^1.6.2",
    "idempotent-babel-polyfill": "^0.1.1",
    "intersection-observer": "^0.5.0",
    "jquery": "^3.3.1",
    "jquery-mobile": "^1.5.0-alpha.1",
    "json-schema-ref-parser": "^5.0.0",
    "lodash": "^4.17.5",
    "mapbox-gl": "^0.53.1",
    "mapbox-gl-vue": "^1.9.0",
    "mapboxgl-spiderifier": "^1.0.9",
    "math": "0.0.3",
    "mixitup": "^3.2.2",
    "moment": "^2.21.0",
    "mongodb": "^3.0.7",
    "mongoose": "^5.0.11",
    "mongoose-uuid2": "^2.1.0",
    "networked-aframe": "git+https://github.com/lifescopelabs/networked-aframe",
    "nipplejs": "^0.7.1",
    "node-fetch": "^2.3.0",
    "node-sass": "^4.11.0",
    "node-uuid": "^1.4.8",
    "nuxt": "^2.5.1",
    "qs": "^6.5.2",
    "sass-loader": "^7.1.0",
    "socket.io": "^2.1.1",
    "socket.io-client": "^2.1.1",
    "subscriptions-transport-ws": "^0.9.16",
    "type-detect": "^4.0.8",
    "useragent": "^2.3.0",
    "utf-8-validate": "^4.0.1",
    "uuid": "^3.2.1",
    "uuid-parse": "^1.0.0",
    "vue-apollo": "^3.0.0-beta.28",
    "vue-bootstrap-datetimepicker": "^4.1.3",
    "vue-cli": "^2.9.6",
    "vue-clickaway": "^2.2.2",
    "vue-js-modal": "^1.3.28",
    "vue-js-toggle-button": "^1.3.2",
    "vue-observe-visibility": "^0.4.3",
    "vue-router": "^3.0.2",
    "vue2-filters": "^0.3.0",
    "whatwg-fetch": "^2.0.4",
    "ws": "^5.1.1"
  }

Если я добавлю assets /, pages / и т. Д. В gulp.src в задаче gulp, приложение будет работать. Я не уверен, почему это необходимо в Nuxt 2, и мне интересно, должен ли Nuxt создавать все это для меня; это похоже на Nuxt 1. Я что-то упустил при переключении с Nuxt 1 на 2?

...