Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

440
Vistas
How to use import * as styles in creat-react-app with css modules

I found that I can not make to work named import with css modules in create-reat-app.

The following code fires an error:

import * as styles from './PriceTable.module.css';

and the error is:

export 'table' (imported as 'styles') was not found in './PriceTable.module.css' (possible exports: default)

I know that I can just use import styles from './PriceTable.module.css'; but this is not what I need as I am using parcel and it requires named imports for tree shaking.

I would appreciate it if anyone has any thoughts about this how to fix it?

Here is the code:

import React from 'react';
import * as styles from './PriceTable.module.css';


const PriceTable = (props) => {    
    console.log(styles)
    return (
        <div className={styles.table}>This is a price table {props.widget} and the hex color is: {props.color} !</div>
    )
}

export default PriceTable;

package.json

{
  "name": "react-widgets",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.16.1",
    "@testing-library/react": "^11.2.7",
    "@testing-library/user-event": "^12.8.3",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-scripts": "5.0.0",
    "web-vitals": "^1.1.2"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "serve-build": "serve -s build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "build:widget": "parcel build src/index.js --no-source-maps --dist-dir docs"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "parcel": "^2.0.1",
    "postcss": "^8.4.5",
    "react-app-rewired": "^2.1.8"
  }
}
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda