nuxt / nuxt

The Intuitive Vue Framework.
https://nuxt.com
MIT License
54.15k stars 4.95k forks source link

Webpack config #479

Closed aymenpeak closed 7 years ago

aymenpeak commented 7 years ago

Can i edit the webpack config? if yes , where?

This question is available on Nuxt.js community (#c417)
pi0 commented 7 years ago

@aymenpeak You can customize it using extend function. See https://nuxtjs.org/api/configuration-build#extend

aymenpeak commented 7 years ago

thanks.

aymenpeak commented 7 years ago

@pi0 i'm trying to add this config config.node = { console: 'empty', fs: 'empty', net: 'empty', tls: 'empty' }

it causes an error any propositions?

pi0 commented 7 years ago

@aymenpeak You may do this only for SSR bundle.

    extend (config, { isServer }) {
      // Extend only webpack config for server-bundle
      if (isServer) {
           // SSR Customizations
      }
    }
aymenpeak commented 7 years ago

@pi0 that take me back to the first error ... image PS: im trying to include the facebook sdk via npm

pi0 commented 7 years ago

@aymenpeak Try removing at least net and fs :))

aymenpeak commented 7 years ago

@pi0 same

pi0 commented 7 years ago

what about config.node = { } ?? :)) I've no idea about your specific error. You should do a step-by-step diagnostics. (ie adding restrictions one by one)

atinux commented 7 years ago

I think that's because @aymenpeak is requiring fs inside a client script right?

Thanks @pi0 for helping us with the issues 🙌

aymenpeak commented 7 years ago

@Atinux yes i'm , but i need it for the facebook package 😢

KonstantinVlasov commented 7 years ago

Hi, @aymenpeak! If you need to use fs, you should do it at server-side. You can create custom express route for fs using express starter template and call it from browser.

aymenpeak commented 7 years ago

i solved my problem by using the javascript sdk instead of the npm one. Thanks anyway guys :peace_symbol:

jaubut commented 7 years ago

I got kind of a same error.. I try to implement moltin in my demo project and even with this it keeps telling me that dependencie fs isnt install ... any help ? There is no other way but trought npm to install the v2 sdk

build: {
    extend (config, { isDev, isClient }) {
      node: {
        fs: 'empty'
      }
    },
    vendor: ['axios']
  }
proko commented 7 years ago

@jaubut I had the same problem with moltin. Inside the extend function I assigned new value to config.node and it worked. config.node = { fs: 'empty' };

jaubut commented 7 years ago

Thanks @proko :) 👍 And did you place your moltin.js services in the plugins directory of in a services directory ? There is this vue exemple that I try to get around.. If you want to share your project, I will love to take a look and learn !!!

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.