Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'getDependenciesToBeIncluded' of undefined #3523

Closed
GerardRodes opened this issue Apr 30, 2020 · 5 comments
Closed

Comments

@GerardRodes
Copy link

GerardRodes commented Apr 30, 2020

  • Rollup Version: 2.7.5 and 2.7.4
  • Operating System (or Browser): ubuntu 18.04
  • Node Version (if applicable): v12.16.2
  • Link to reproduction (IMPORTANT, read below): I cannot reproduce it out of my repo but i cannot share it

Expected Behavior

build success

Actual Behavior

(!) Circular dependency
src/filters/check.js -> src/filters/index.js -> src/filters/check.js
[!] TypeError: Cannot read property 'getDependenciesToBeIncluded' of undefined
TypeError: Cannot read property 'getDependenciesToBeIncluded' of undefined
    at analyzeModuleGraph (/builds/development/oa-style/node_modules/rollup/dist/shared/rollup.js:17538:45)
    at getChunkAssignments (/builds/development/oa-style/node_modules/rollup/dist/shared/rollup.js:17473:67)
    at Graph.generateChunks (/builds/development/oa-style/node_modules/rollup/dist/shared/rollup.js:18316:19)
    at Graph.build (/builds/development/oa-style/node_modules/rollup/dist/shared/rollup.js:18257:29)

2.7.2 works well

@lukastaegert
Copy link
Member

This looks serious but if you can give us nothing but this stack trace, it will be quite hard to spot. rollup.config at the very least. Otherwise, actual file contents are probably not important, just imports and exports are what likely matters. Any help welcome, otherwise I need to close this because I would not even know when the issue is fixed.

@shellscape
Copy link
Contributor

For a refresher:

Issues without minimal reproductions will be closed! Please provide a link to one by:

  1. Using the REPL at https://rollupjs.org/repl/, or
  2. Using the REPL.it reproduction template at https://repl.it/@rollup/rollup-repro
    (allows full use of all rollup options and plugins), or
  3. Provide a minimal repository link (Read https://git.io/fNzHA for instructions).
    These may take more time to triage than the other options.

Please add a reproduction and we'll be happy to triage further.

@GerardRodes
Copy link
Author

This looks serious but if you can give us nothing but this stack trace, it will be quite hard to spot. rollup.config at the very least. Otherwise, actual file contents are probably not important, just imports and exports are what likely matters. Any help welcome, otherwise I need to close this because I would not even know when the issue is fixed.

sure here is the full content of the rollup.config.js

const path = require('path')

const commonjs = require('@rollup/plugin-commonjs')
const babel = require('rollup-plugin-babel')
const multiInput = require('rollup-plugin-multi-input').default
const resolve = require('@rollup/plugin-node-resolve')
const json = require('@rollup/plugin-json')
const postcss = require('rollup-plugin-postcss')
const VuePlugin = require('rollup-plugin-vue')
const OAStyleAutoimport = require('@oa/rollup-plugin-oastyle-autoimport')
const cssRemoveDeepSelector = require('./rollup-plugins/css-remove-deep-selector')
const progress = require('rollup-plugin-progress')
const serve = require('rollup-plugin-serve')
const livereload = require('rollup-plugin-livereload')
const replace = require('@rollup/plugin-replace')
const selectComponent = require('./samples/selectComponent.js')

const isDev = process.env.NODE_ENV === 'development'

let componentForDev
let componentNameForDev

const createConfig = async function () {
  if (isDev && !componentForDev) {
    componentForDev = await selectComponent()
    componentNameForDev = componentForDev.replace(/\.vue$/, '')
  }

  return {
    input: isDev
      ? [
        'src/oastyle.js',
        `samples/${componentForDev}`,
        'src/styles/oastyle.pcss',
      ]
      : [
        'src/styles/oastyle.pcss',
        'src/oastyle.js',
        'src/components/**/*',
        'src/mixins/**/*',
        'src/filters/**/*',
        'src/processors/**/*',
      ],
    output: {
      format: 'esm',
      dir: 'dist',
      sourcemap: false,
    },
    external: isDev ? 'vue' : undefined,
    plugins: [
      OAStyleAutoimport(),
      VuePlugin({
        css: false,
        style: {
          postcssCleanOptions: { disabled: true },
        },
      }),

      json(),
      postcss({
        extract: true,
      }),

      resolve({
        extensions: ['.vue', '.js', '.json', '.pcss', '.css'],
        jail: isDev ? undefined : path.resolve(__dirname, 'src'),
        browser: true,
      }),
      babel(
        isDev // this will transpile linked dependencies
          ? {
            test: /\.js$/,
            exclude: /node_modules/,
            presets: [
              '@oa/oa',
            ],
          }
          : undefined,
      ),
      commonjs(),

      multiInput(),

      cssRemoveDeepSelector(),
      progress(),

      isDev && serve({ contentBase: 'dist', port: 8080, host: '0.0.0.0' }),
      isDev && livereload('dist'),
      isDev && replace({
        delimiters: ['', ''],
        'process.env.NODE_ENV': "'development'",
        "from 'vue'": "from 'https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.11/vue.esm.browser.js'",
      }),
      isDev && {
        generateBundle () {
          this.emitFile({
            type: 'asset',
            name: 'index.html',
            fileName: 'index.html',
            source: `
              <html>
                <head>
                  <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
                  <meta content="utf-8" http-equiv="encoding">
                  <meta name="viewport" content="width=device-width,initial-scale=1.0">

                  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/fontawesome.min.css" />
                  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/solid.min.css" />
                  <link href="https://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700&amp;display=swap" rel="stylesheet">
                  <link rel="stylesheet" href="/oastyle.css" />

                  <script type="module">
                    import Vue from 'https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.11/vue.esm.browser.js'
                    import ${componentNameForDev} from '/samples/${componentNameForDev}.js'
                    import OAStyle from '/oastyle.js'

                    Vue.use(OAStyle, {
                      theme: {
                        primary: '#ececec',
                        'primary-light': '#c0c0c0',
                        'primary-dark': '#464646',

                        accent: '#ae7dd4',
                        'accent-dark': '#79628c',
                        'accent-light': '#d298ff',

                        secondary: '#DE6759',
                        'secondary-light': '#ffa30f',
                        'secondary-dark': '#C75A69',

                        success: '#1EBA6A',
                        'success-light': '#5BC68E',
                        'success-dark': '#2F5254',

                        warning: '#ffbb33',
                        'warning-light': '#ffde2a',
                        'warning-dark': '#FF8800',
                        'warning-darker': '#e0630a',

                        error: '#FF4136',
                        'error-light': '#ff4444',
                        'error-dark': '#950202',
                        'error-darker': '#471f1f',

                        info: '#33b5e5',
                        'info-light': '#7FDBFF',
                        'info-dark': '#0099CC',

                        background: '#33333D',
                        'background-light': '#373840',
                        'background-lighter': '#575963',
                        'background-dark': '#1f1f25',
                        'background-darker': '#151515',

                        text: '#c1c1c1',
                        'text-light': '#ececec',
                        'text-lighter': '#fafafa',
                        'text-dark': '#333',
                      }
                    })

                    // Mocked for OAApp as an error was been throw because $route was used in render
                    Vue.use({
                      install (Vue) {
                        Vue.prototype.$route = {
                          path: '/',
                          query: {},
                          params: {},
                          fullPath: '/',
                          name: 'component',
                          meta: {
                            title: '${componentNameForDev}'
                          }
                        }
                      }
                    })

                    new Vue({
                      el: '#app',
                      render: h => h(${componentNameForDev})
                    })
                  </script>
                </head>
                <body>
                  <div id="app"></div>
                </body>
              </html>
            `,
          })
        },
      },
    ],
  }
}

module.exports = createConfig()

@lukastaegert
Copy link
Member

Found some bug, please see if #3526 fixes yours and close this issue appropriately.

@GerardRodes
Copy link
Author

Found some bug, please see if #3526 fixes yours and close this issue appropriately.

looks like on 2.7.6 it's working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants