[Feature] Tailwind CSS V2 Support
Support using this plugin with both tailwindcss@v3 and tailwindcss@v2.
Pending on https://github.com/web-infra-dev/rslib/issues/413
👀 Does this issue rely on https://github.com/web-infra-dev/rslib/issues/413 to build this package itself?
Yes, I'm going to check tailwindcss/package.json#version and use a different Rspack plugin for Tailwind CSS V2. And currently this will give an error since Rslib removes the Import Attributes.
But there is another way to support Tailwind CSS V2. By publishing a different version of this plugin for Tailwind CSS V2.
How about using fs and require.resovle to read tailwindcss/package.json?
Yeah, we should go this way. I just checked that Import Attributes is not supported in NodeJS 16 :)
> import('./package.json', { with: {type: 'json'} })
Promise {
<pending>,
[Symbol(async_id_symbol)]: 255,
[Symbol(trigger_async_id_symbol)]: 5
}
> Uncaught:
TypeError [ERR_IMPORT_ASSERTION_TYPE_MISSING]: Module "file:///root/package.json" needs an import assertion of type "json"
at __node_internal_captureLargerStackTrace (node:internal/errors:478:5)
at new NodeError (node:internal/errors:387:5)
at validateAssertions (node:internal/modules/esm/assert:82:15)
at defaultLoad (node:internal/modules/esm/load:84:3)
at nextLoad (node:internal/modules/esm/loader:163:28)
at ESMLoader.load (node:internal/modules/esm/loader:605:26)
at ESMLoader.moduleProvider (node:internal/modules/esm/loader:457:22)
at new ModuleJob (node:internal/modules/esm/module_job:63:26)
at ESMLoader.#createModuleJob (node:internal/modules/esm/loader:480:17)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:434:34)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:530:24)
at async importModuleDynamicallyWrapper (node:internal/vm/module:438:15) {
code: 'ERR_IMPORT_ASSERTION_TYPE_MISSING'
}
> process.version
'v16.20.0'