babel.md (hugo-0.80.0) | : | babel.md (hugo-0.81.0) | ||
---|---|---|---|---|
skipping to change at line 30 | skipping to change at line 30 | |||
{{% note %}} | {{% note %}} | |||
Hugo Pipe's Babel requires the `@babel/cli` and `@babel/core` JavaScript package s to be installed in the project or globally (`npm install -g @babel/cli @babel/ core`) along with any Babel plugin(s) or preset(s) used (e.g., `npm install @bab el/preset-env --save-dev`). | Hugo Pipe's Babel requires the `@babel/cli` and `@babel/core` JavaScript package s to be installed in the project or globally (`npm install -g @babel/cli @babel/ core`) along with any Babel plugin(s) or preset(s) used (e.g., `npm install @bab el/preset-env --save-dev`). | |||
If you are using the Hugo Snap package, Babel and plugin(s) need to be installed locally within your Hugo site directory, e.g., `npm install @babel/cli @babel/c ore --save-dev` without the `-g` flag. | If you are using the Hugo Snap package, Babel and plugin(s) need to be installed locally within your Hugo site directory, e.g., `npm install @babel/cli @babel/c ore --save-dev` without the `-g` flag. | |||
{{% /note %}} | {{% /note %}} | |||
### Config | ### Config | |||
{{< new-in "v0.75.0" >}} | {{< new-in "v0.75.0" >}} | |||
In Hugo `v0.75` we improved the way we resolve JS configuration and dependencies . One of them is that we now adds the main project's `node_modules` to `NODE_PAT H` when running Babel and similar tools. There are some known [issues](https://g ithub.com/babel/babel/issues/5618) with Babel in this area, so if you have a `ba bel.config.js` living in a Hugo Module (and not in the project itself), we recom mend using `require` to load the presets/plugins, e.g.: | In Hugo `v0.75` we improved the way we resolve JS configuration and dependencies . One of them is that we now add the main project's `node_modules` to `NODE_PATH ` when running Babel and similar tools. There are some known [issues](https://gi thub.com/babel/babel/issues/5618) with Babel in this area, so if you have a `bab el.config.js` living in a Hugo Module (and not in the project itself), we recomm end using `require` to load the presets/plugins, e.g.: | |||
```js | ```js | |||
module.exports = { | module.exports = { | |||
presets: [ | presets: [ | |||
[ | [ | |||
require('@babel/preset-env'), | require('@babel/preset-env'), | |||
{ | { | |||
useBuiltIns: 'entry', | useBuiltIns: 'entry', | |||
corejs: 3 | corejs: 3 | |||
} | } | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added |