Skip to content
This repository was archived by the owner on Dec 19, 2024. It is now read-only.

Commit cba3b6c

Browse files
committed
Fixed: plugin can be consumed correctly from es5 environment (2.0.1)
1 parent b720b8c commit cba3b6c

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 2.0.1 - 2015-09-14
2+
3+
- Fixed: plugin can be consumed correctly from es5 environment
4+
([#11](https://github.com/cssnext/postcss-cssnext/issues/11))
5+
16
# 2.0.0 - 2015-09-14
27

38
- Added: support for PostCSS v5.x

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "postcss-cssnext",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "Use tomorrow's CSS syntax, today",
55
"keywords": [
66
"css",

src/index.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import { isSupported } from "caniuse-api"
44
import libraryFeatures from "./features"
55
import featuresActivationMap from "./features-activation-map"
66

7-
export { libraryFeatures as features }
8-
9-
export default postcss.plugin("postcss-cssnext", (options) => {
7+
const plugin = postcss.plugin("postcss-cssnext", (options) => {
108
options = {
119
features: {},
1210
// options.browsers is deliberately undefined by default to inherit
@@ -68,3 +66,15 @@ export default postcss.plugin("postcss-cssnext", (options) => {
6866

6967
return processor
7068
})
69+
70+
// according to the way babel transpile es6 module
71+
// we cannot use the following syntax to export features
72+
//
73+
// export { libraryFeatures as features }
74+
//
75+
// babel only add `module.exports = exports["default"];` if there is only one
76+
// thing exported
77+
// so we add `features` as a plugin property
78+
plugin.features = libraryFeatures
79+
80+
export default plugin

0 commit comments

Comments
 (0)