neutrino icon indicating copy to clipboard operation
neutrino copied to clipboard

Issue: alias and config externals

Open soyjavi opened this issue 3 years ago • 3 comments

issue

Please try to answer the following questions:

  • What version of Neutrino are you using? 4.9.0
  • Are you trying to use any presets? If so, which ones, and what versions? @neutrinojs/react-components
  • Are you using the Yarn client or the npm client? What version? yarn 1.22.4
  • What version of Node.js are you using? v14.4.0
  • What operating system are you using? mac os
  • What did you do? i create an alias @aurora pointing to a node module
  • What did you expect to happen? I expect this alias dont be part of the final build
  • What actually happened, contrary to your expectations? Even if i set up the externals the final build gets all the code from the node module
neutrino.config.resolve.alias.set('@aurora', path.resolve(__dirname, './node_modules/@lookiero/aurora/web'))

then i setup the external

neutrino.config.when(process.env.NODE_ENV === 'production', (config) => {
  config.externals([
    '@aurora',
  ]);
});

soyjavi avatar Sep 21 '20 12:09 soyjavi

You probably mean Neutrino 9.4.0 and not 4.9.0

Neutrino just outputs a Webpack config. You can console.log(module.exports) in webpack.config.js to check if it matches your expectations. If it does then it is an issue in the configuration logic, not the Neutrino.

constgen avatar Sep 22 '20 18:09 constgen

You can console.log(module.exports) in webpack.config.js to check if it matches your expectations

Printing the object directly works for some parts of it, but others will be a bit quirky. For the most accurate (and annotated) output, I'd use: https://neutrinojs.org/usage/#inspecting-the-generated-webpack-config

edmorley avatar Sep 22 '20 18:09 edmorley

@edmorley It works. But I had problems with visualizing configs in my project caused by extremely huge ESLint config that is a part of Webpack loader. So I decided to go with default console behavior - only several levels nested objects are shown

constgen avatar Sep 29 '20 10:09 constgen