aphrodite icon indicating copy to clipboard operation
aphrodite copied to clipboard

fix no-important entry resolve

Open wangcheng opened this issue 7 years ago • 3 comments

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.

wangcheng avatar Apr 19 '19 04:04 wangcheng

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

khanbot avatar Apr 19 '19 04:04 khanbot

[clabot:check]

wangcheng avatar Apr 19 '19 07:04 wangcheng

CLA signature looks good :+1:

khanbot avatar Apr 19 '19 07:04 khanbot