Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Documentation]: Instruction how to make it work with next.js #74

Closed
2 tasks done
bolora opened this issue Jul 25, 2022 · 3 comments
Closed
2 tasks done

[Documentation]: Instruction how to make it work with next.js #74

bolora opened this issue Jul 25, 2022 · 3 comments
Labels
documentation Improvements or additions to documentation

Comments

@bolora
Copy link

bolora commented Jul 25, 2022

Description

For https://cloudscape.design/get-started/integration/using-cloudscape-components/

There should be instructions for nextJS installation to address this issue:

./node_modules/@cloudscape-design/components/alert/styles.scoped.css
Global CSS cannot be imported from within node_modules.
Read more: https://nextjs.org/docs/messages/css-npm
Location: node_modules/@cloudscape-design/components/alert/styles.css.js

Along with installing cloudscape library you need to do the following if using NextJS:

  • npm install next-transpile-modules
  • Update next.config.js file
    • Import next-transpile-modules: const withTranspileModules = require('next-transpile-modules');
    • Add this into the withPlugins declaration at the bottom: [withTranspileModules(['@cloudscape-design/components'])],

Alternatively you can address this: https://nextjs.org/docs/messages/css-npm

Code of Conduct

@bolora bolora added the documentation Improvements or additions to documentation label Jul 25, 2022
@just-boris just-boris changed the title [Documentation]: [Documentation]: Instruction how to make it work with next.js Jul 26, 2022
@zhubby
Copy link

zhubby commented Jul 26, 2022

👍

@david-martyn-ford
Copy link

david-martyn-ford commented Jul 26, 2022

Usage with NX.

// eslint-disable-next-line @typescript-eslint/no-var-requires
const withNx = require('@nrwl/next/plugins/with-nx');
const withTranspileModules = require('next-transpile-modules');
const withPlugins = require('next-compose-plugins');

/**
 * @type {import('@nrwl/next/plugins/with-nx').WithNxOptions}
 **/
const nextConfig = {
  nx: {
    // Set this to true if you would like to to use SVGR
    // See: https://github.com/gregberge/svgr
    svgr: false,
  },
};

module.exports = withPlugins([
  withNx(nextConfig),
  withTranspileModules(['@cloudscape-design/components']),
]);

@FlorianDr
Copy link
Contributor

Thank you everyone for the suggestions. We will add a reference to this issue to the Integration page to contain integration advice in one place.

@cloudscape-design cloudscape-design locked and limited conversation to collaborators Jul 28, 2022
@FlorianDr FlorianDr converted this issue into discussion #86 Jul 28, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants