Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Add neutrino --inspect support for alternative config filenames (#1612)
Browse files Browse the repository at this point in the history
  • Loading branch information
SilvaQ authored Oct 12, 2020
1 parent 992878d commit cdb0801
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,12 @@ Or:
NODE_ENV={production,development,test} neutrino --inspect
```

If your Neutrino configuration file is not named `.neutrinojs.js`, specify the filename using `--config`. For example:

```bash
neutrino --inspect --mode {production,development} --config .custom.neutrino.config.js
```

As of Neutrino 9, the `--inspect` output when using the official presets is now sufficiently
self-contained that it can be passed to webpack with no additional changes required.

Expand Down
9 changes: 9 additions & 0 deletions packages/neutrino/bin/neutrino.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
#!/usr/bin/env node

const yargsParser = require('yargs-parser');
const { join } = require('path');
const neutrino = require('..');

const argv = yargsParser(process.argv.slice(2));

if (argv.inspect) {
if (argv.config) {
// eslint-disable-next-line global-require, import/no-dynamic-require
const middleware = require(join(process.cwd(), argv.config));
neutrino(middleware).inspect();
process.exit();
}
neutrino().inspect();
process.exit();
}
Expand All @@ -17,6 +24,8 @@ https://neutrinojs.org/migration-guide/
You may still inspect the generated webpack configuration using:
neutrino --inspect --mode {production,development}
or inspect with custom config
neutrino --inspect --mode {production,development} --config .custom.neutrino.config
`);

process.exit(1);

0 comments on commit cdb0801

Please sign in to comment.