Skip to content

Commit

Permalink
chore(package): re-export module in commonjs format
Browse files Browse the repository at this point in the history
BREAKING CHANGE: remove having to use `.default` while requiring this module

closes #19
  • Loading branch information
medfreeman committed Sep 20, 2017
1 parent a0042d3 commit 1bba36c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
13 changes: 2 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,16 @@

`npm i -D nuxt-netlify-cms netlify-cms` OR `yarn add -D nuxt-netlify-cms netlify-cms`

- Require `nuxt-netlify-cms` at the start of `nuxt.config.js`

```js
var netlifyCmsModule = require("nuxt-netlify-cms").default;
```

:information_source: Note the `.default` in the above snippet. It is mandatory for this module, written in ES6, to work properly.
Please read [Misunderstanding ES6 Modules, Upgrading Babel, Tears, and a Solution](https://medium.com/@kentcdodds/misunderstanding-es6-modules-upgrading-babel-tears-and-a-solution-ad2d5ab93ce0) if you're interested to know why.

- Add `nuxt-netlify-cms` to `modules` section of `nuxt.config.js`

```js
{
modules: [
// Simple usage
netlifyCmsModule,
"nuxt-netlify-cms",

// With options
[netlifyCmsModule, { adminPath: "secure" }],
["nuxt-netlify-cms", { adminPath: "secure" }],
],

// You can optionally use global options instead of inline form
Expand Down
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var netlifyCmsModule = require("./dist/module.js");
module.exports = netlifyCmsModule.default;
module.exports.meta = netlifyCmsModule.meta;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Easy Netlify CMS integration with nuxt.js",
"version": "1.2.1",
"license": "MIT",
"main": "dist/module.js",
"main": "index.js",
"author": "Mehdi Lahlou <mehdi.lahlou@free.fr>",
"repository": "https://github.com/medfreeman/nuxt-netlify-cms-module.git",
"scripts": {
Expand Down

0 comments on commit 1bba36c

Please sign in to comment.