Skip to content

Commit

Permalink
feat(config): allow targeting specific Node version in babel preset
Browse files Browse the repository at this point in the history
This commit adds a config option "node" to hops-config which allows the
user to define a specific Node.js version which the transpiled
middleware should target.
  • Loading branch information
ZauberNerd authored and dmbch committed Nov 10, 2017
1 parent bded47a commit 4437c6b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/build-config/sections/module-rules/babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ exports.default = getBabelLoader(
);

exports.node = getBabelLoader(
{ node: 'current' },
{ node: hopsConfig.node },
require.resolve('babel-plugin-dynamic-import-node')
);
1 change: 1 addition & 0 deletions packages/config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ The configuration is immutable at runtime - if you import it in your own applica
| `basePath` | `String` | Root path of your application on the server. This is inserted as an HTTP path prefix between `host` and `locations`. For example, if you set e.g. `"basePath": "my-custom-basepath"` and `"location": ["/profile"]`, then your application would be available at `http://0.0.0.0:8080/my-custom-basepath/profile/` |
| `assetPath` | `String` | HTTP root path of your asset files on the server. It's not dependent on `basePath`, you can define totally separate directories |
| `browsers` | `String` | [Browserslist](https://www.npmjs.com/package/browserslist) query. Defaults to `"> 1%, last 2 versions, Firefox ESR"` (which is also the Browserlist default query). It is used for Babel and PostCSS |
| `node` | `String` | [Node target version](https://www.npmjs.com/package/babel-preset-env#targetsnode). Defaults to `current`. It is used to specify the Node version which Babel should compile for |
| `moduleDirs` | `Array<string>` | One or more directories that Hops should use for module path resolution. For example, you can specify a directory that holds a yet unpublished Node.js package. It works similar to the [resolve.modulesDirectories](http://webpack.github.io/docs/configuration.html#resolve-modulesdirectories) field in Webpack, i.e. if you specify `moduleDirs: ["my-module-dir"]`, it will look in `./my-module-dir`, `../my-module-dir`, `../../my-module-dir` and so on |
| `appDir` | `String` | Directory of your app. This way, you can put your app to a place other than project root. Defaults to `"."` |
| `buildDir` | `String` | Directory where the build artifacts (i.e. your application/asset files) will be saved to. Defaults to `"build"`. Hops always removes the specified directory before starting a new build |
Expand Down
1 change: 1 addition & 0 deletions packages/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ module.exports = freeze(
basePath: '',
assetPath: '',
browsers: '> 1%, last 2 versions, Firefox ESR',
node: 'current',
moduleDirs: [],
appDir: '.',
buildDir: 'build',
Expand Down

0 comments on commit 4437c6b

Please sign in to comment.