Khan / aphrodite

Framework-agnostic CSS-in-JS with support for server-side rendering, browser prefixing, and minimum CSS generation
5.34k stars 188 forks source link

fix no-important entry resolve #374

Open wangcheng opened 5 years ago

wangcheng commented 5 years ago

If I use import {css} from 'aphrodite/no-important' in a ES module file, bundle tools like Rollup will resolve aphrodite/no-important to node_modules/aphrodite/no-important.js and then node_modules/aphrodite/lib/no-important.js which is not a ES module. To make things worse, rollup-plugin-commonjs cannot resolve named import (import {X} from 'x') for CommonJS modules.

A workaround is to use import {css} from 'aphrodite/es/no-important'. However this doesn't work for 'universal' code because ES module cannot be resolved in Node environment without being transpiled.

This change will let module resolver find package.json file in node_modules/aphrodite/no-important directory.

khanbot commented 5 years ago

Hey @wangcheng678,

Thanks for the PR! Mind signing our Contributor License Agreement?

When you've done so, go ahead and comment [clabot:check] and I'll check again.

Yours truly, khanbot

wangcheng commented 5 years ago

[clabot:check]

khanbot commented 5 years ago

CLA signature looks good :+1: