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

FATAL Nuxt Build Error #37

Open
chiboreache opened this issue Mar 9, 2019 · 6 comments
Open

FATAL Nuxt Build Error #37

chiboreache opened this issue Mar 9, 2019 · 6 comments

Comments

@chiboreache
Copy link

Wildcard import — causing error
Dot import — simple not working

  # Nuxt.js modules
  modules:
    [
      '@nuxtjs/style-resources'
      './modules/coffeescript'
    ]

  styleResources:
    stylus:
      [
        '~assets/*.styl' 
         or './assets/*.styl'

        '~assets/mixins.styl'
        '~assets/card-base.styl'
      ]

npx nuxt build →
Version: webpack 4.29.6

ERROR in ./components/GHCard.vue?vue&type=style&index=0&id=0e928d29&lang=stylus&scoped=true& (./node_modules/css-loader/dist/cjs.js??ref--10-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--10-oneOf-1-2!./node_modules/stylus-loader??ref--10-oneOf-1-3!./node_modules/vue-loader/lib??vue-loader-options!./components/GHCard.vue?vue&type=style&index=0&id=0e928d29&lang=stylus&scoped=true&)
Module build failed (from ./node_modules/postcss-loader/src/index.js):
TypeError: Cannot read property 'type' of undefined

and so on

"dependencies": {
    "@nuxtjs/style-resources": "^0.1.2",
    "axios": "^0.18.0",
    "coffee-loader": "^0.8.0",
    "coffeescript": "^2.0.1",
    "nuxt": "*",
    "pug": "^2.0.3",
    "pug-plain-loader": "^1.0.0",
    "stylus": "^0.54.5",
    "stylus-loader": "^3.0.2"
  }
@chiboreache
Copy link
Author

I also tried nuxt-stylus-resources-loader

resolve = require('path').resolve
['nuxt-stylus-resources-loader', resolve(__dirname, 'assets/**/*.styl')]

with almost the same result, error message now is a little bit more verbose

at WebpackBundler.webpackCompile (node_modules/@nuxt/webpack/dist/webpack.js:5262:15)
at processTicksAndRejections (internal/process/next_tick.js:81:5)

@manniL
Copy link
Collaborator

manniL commented Mar 9, 2019

@chiboreache Hey 👋

Please provide a reproduction repo.

Dynamic asset imports should work like shown in
https://github.com/nuxt-community/style-resources-module/blob/master/test/fixture/sass/nuxt.config.js#L11
(pre-processor-independent)

@chiboreache
Copy link
Author

@manniL hello again ✋

Nice link, but I'm using stylus ;)

so example file says

styleResources: {
    stylus: ['~assets/variables.styl']
  },

I can't provide anything, I just have mixins and styl file with classes, which are I want to reuse by importing in pages via `@import '~assets/someClasses' or globally, as I mentioned above

Global import not work, meanwhile simple importing works in dev and causing an error during the building time

Just right after the message: additional chunk assets processing (91%)

@manniL
Copy link
Collaborator

manniL commented Mar 9, 2019

Try @/assets as prefix.

I can't provide anything, I just have mixins and styl file with classes, which are I want to reuse by importing in pages via `@import '~assets/someClasses' or globally, as I mentioned above

Then you can reproduce it by putting them in a codesandbox so I can play around with the project ;)

@chiboreache
Copy link
Author

Just loaded my mega neat setup into CS, and apparently @import does not provide any errors... Maybe something with my local webpack, but I'll investigate that tomorrow, I'm going to sleep, finally 🌙

furthermore, I realised some undocumented logic

css: ['~assets/onlyForStyling.styl'],

styleResources: {
    stylus: ['~assets/everythingElse.styl'] or even
	stylus: ['~assets/*.styl'] but not without css object
  },

So it works, sort of
but not like that css: ['~assets/styl.styl', '~assets/mixins.styl'],
or that css: ['~assets/*.styl'],

So yeah, have fun heh

https://codesandbox.io/s/o7rppmxmny?fontsize=14&module=%2Fnuxt.config.js
index — /assets — config

@chiboreache
Copy link
Author

chiboreache commented Mar 10, 2019

So, I'm back
Here is working example (vuex store stop working for some reason, but whatever)

My conclusion:

css:

  • handles only styles in the .styl files
  • doesn't accept wildcard way of importing

styleResources:

  • handles only mixins
  • accepts wildcard
  • but "getting" only mixin functions from it

but I am still get an error for my project 😔


Ironically problem was in just an one string of styl file — transform: rotate3D(0)

what a shame...

but yeah, it would be awesome if compiler in dev mode told me about that earlier >_< some one will update the docs ^_^
dry docs is always causing some stupid issues..

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

2 participants