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

Using Vue Design System in Nuxt is throwing errors about export in system.js #91

Closed
michaelpumo opened this issue Jun 25, 2018 · 6 comments
Assignees
Labels

Comments

@michaelpumo
Copy link

michaelpumo commented Jun 25, 2018

Hi!

I am trying to get the components imported into a Nuxt project, following the steps here:
https://github.com/viljamis/vue-design-system/wiki/getting-started#using-design-system-as-an-npm-module

Nuxt does not have a main.js (everything is plugin based), so what I have done is create a "plugin" and then do the import code in there like so (Nuxt recommends this for other libraries too and works fine):

vue-design-system.js

import Vue from 'vue'
import system from 'fp-design-system'
import 'fp-design-system/dist/system/system.css'

Vue.use(system)

Then in my config I do (removed other code in config):

nuxt.config.js

module.exports = {
  css: [
    { src: 'fp-design-system/dist/system/system.css', lang: 'css' }
  ],
  plugins: [
    { src: '~plugins/vue-design-system', ssr: true }
  ],
  build: {
    vendor: [
      'fp-design-system'
    ]
  }
}

When I run npm run dev in my theme, it builds, but I get a warning:

WARNING  Compiled with 1 warnings
warning  in ./plugins/vue-design-system.js
7:8-14 "export 'default' (imported as 'system') was not found in 'fp-design-system'

Seems to have an issue with the generated system.js regarding the export (the command npm run build:system).

In my page on screen I get the following error when trying to use a component in the design system:

NuxtServerError
Cannot find module 'fp-design-system/src/elements/TextStyle' from '/Users/paranoidandroid/Documents/websites/Nuxt-SSR'

If I hard refresh the page, I then get another message:

NuxtServerError
render function or template not defined in component: anonymous

Any idea what's happening here? It would be really great to get this working somehow.

At this current time, I'm not sure if it's a Nuxt issue or a Vue Design System issue. I think the latter, just because the Nuxt setup I have right now is very bare-bones...so it's not something else causing this.

Thanks.

@michaelpumo michaelpumo changed the title Using VDS in Nuxt Using VDS in Nuxt is throwing errors about export in system.js Jun 25, 2018
@michaelpumo michaelpumo changed the title Using VDS in Nuxt is throwing errors about export in system.js Using Vue Design System in Nuxt is throwing errors about export in system.js Jun 25, 2018
@jackbarham
Copy link

I'm having the same issue. Has anyone got this working with Nuxt.js at all?

@arielsalminen
Copy link
Owner

Hey folks! Just returned from a 5 week “offline” trip, hence the little delay here. Let me get back to this early next week when I’ve survived the jet lag :)

@michaelpumo
Copy link
Author

Thanks @viljamis; much appreciated and hope you had a great holiday!

@arielsalminen
Copy link
Owner

@michaelpumo looking into this now.

@arielsalminen
Copy link
Owner

Looks like the whole library build has to be changed drastically, no easy way around. Will probably have to switch from Webpack to Rollup to make the library build as Webpack does not support ES Module build currently (Currently Vue Design System builds UMD module).

@arielsalminen
Copy link
Owner

@michaelpumo I will close this issue as I figured out the issue isn’t really related to Nuxt, but it was already noticed in this earlier issue #90, so let’s continue discussion there :)

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

No branches or pull requests

3 participants