This repository was archived by the owner on Aug 26, 2021. It is now read-only.
Description Bug Report
What happened
React ES modules have .css require statements in them which causes several issues and is an anti-pattern.
For example @gov.au/button -> node_modules/@gov.au/buttons/lib/js/react.es5.js:6
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
exports['default'] = void 0;
var _react = _interopRequireDefault(require('react'));
var _propTypes = _interopRequireDefault(require('prop-types'));
require('../css/styles.css');
Line 6 require('../css/styles.css'); is not good for the following reasons listed here https://nextjs.org/docs/messages/css-npm :
Importing CSS files within node_modules cannot be supported because we cannot know the correct behavior:
Should the file be consumed as Global CSS or CSS Modules?
If Global, in what order does the file need to be injected?
If Modules, what are the emitted class names? As-is, camel-case, snake case?
Etc...
One issue is your packages by default are not supported by standard a Next.js install.
What I expected to happen
It would be great if we could import css separately, perhaps directly from pancake?
import '../../../../pancake/css/pancake.min.css'
Perhaps we don't need pancake for React components. Build tools like webpack are already quite optimised to shake out unneeded code.
👍 React with 👍 1liamfiddler