Nuxt.js: Webpack config

Created on 30 Mar 2017  路  16Comments  路  Source: nuxt/nuxt.js

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

This question is available on Nuxt.js community (#c417)

Most helpful comment

@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' };

All 16 comments

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

thanks.

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

it causes an error
any propositions?

@aymenpeak You may do this only for SSR bundle.

    extend (config, { isServer }) {
      // Extend only webpack config for server-bundle
      if (isServer) {
           // SSR Customizations
      }
    }

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

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

@pi0 same

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)

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

Thanks @pi0 for helping us with the issues 馃檶

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

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.

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

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']
  }

@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' };

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 !!!

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danieloprado picture danieloprado  路  3Comments

mattdharmon picture mattdharmon  路  3Comments

vadimsg picture vadimsg  路  3Comments

vadimsg picture vadimsg  路  3Comments

shyamchandranmec picture shyamchandranmec  路  3Comments