the microbundle support css

237 Views Asked by At

I have write a public lib and now using microbundle https://github.com/developit/microbundle to build, now I found the microbundle did not build the css by default, then I tried to tweak the command like this:

"scripts": {
        "build": "microbundle --css inline --css-modules true",
        "dev": "microbundle watch --css inline --css-modules true"
    },

the css still did not compile, this is how I import css in the public lib:

import "./Pay.css";

the Pay.tsx and Pay.css in the same folder. this is the full configiration of package.json:

{
    "name": "rd-component",
    "type": "module",
    "version": "0.1.42",
    "source": "src/index.ts",
    "types": "dist/index.d.ts",
    "files": [
        "dist"
    ],
    "exports": {
        "types": "./dist/rdc.d.ts",
        "default": "./dist/rdc.modern.js"
    },
    "main": "./dist/rdc.cjs",
    "module": "./dist/rdc.module.js",
    "unpkg": "./dist/rdc.umd.js",
    "scripts": {
        "build": "microbundle --css inline --css-modules true",
        "dev": "microbundle watch --css inline --css-modules true"
    },
    "devDependencies": {
        "@types/react": "^18.2.0",
        "@types/redux-logger": "^3.0.9",
        "axios": "^1.3.4",
        "js-wheel": "https://github.com/jiangxiaoqiang/js-wheel.git",
        "microbundle": "^0.15.1",
        "react": "^18.2.0",
        "react-dom": "^18.2.0",
        "react-redux": "^8.0.5",
        "redux": "^4.2.1",
        "redux-logger": "^3.0.6",
        "uuid": "^9.0.0"
    },
    "dependencies": {
        "@reduxjs/toolkit": "^1.9.5",
        "antd": "^5.4.6"
    }
}

is it possible to make microbundle handle the css file correct?

0

There are 0 best solutions below