Skip to content
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

Tw test assets extensions #6

Open
wants to merge 4 commits into
base: cssPath-resolvePath
Choose a base branch
from

Conversation

dcrall
Copy link
Owner

@dcrall dcrall commented May 16, 2022

Test the specification of extensions array in resolvePath to resolve a CSS file that does not include the .css extension.

  tailwindcss: {
    configPath: '@dcrall/tw-test/tailwind.config.js',
    cssPath: '~/assets/tailwind',
    exposeConfig: true
  },

When specifying the extensions, the config above works.

tw-test-assests-extensions

However, when I try to import from an NPM package without the extension, the resolution fails. As the specified path is not seen as part of the package's exports.

  tailwindcss: {
    configPath: '@dcrall/tw-test/tailwind.config.js',
    cssPath: '@dcrall/tw-test/tailwind',
    exposeConfig: true
  },
 ERROR  Cannot restart nuxt:  Package subpath './tailwind' is not defined by "exports" in /Users/dcrall/Projects/tailwindcss-module/node_modules/@dcrall/tw-test/package.json                                                                                                                                 11:45:18

  at new NodeError (node:internal/errors:371:5)
  at throwExportsNotFound (node:internal/modules/esm/resolve:429:9)
  at packageExportsResolve (node:internal/modules/esm/resolve:705:3)
  at resolveExports (node:internal/modules/cjs/loader:482:36)
  at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
  at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
  at Function.resolve (node:internal/modules/cjs/helpers:108:19)
  at Function._resolve [as resolve] (node_modules/jiti/dist/jiti.js:1:192841)
  at resolveModule (node_modules/@nuxt/kit/dist/index.mjs:227:41)
  at tryResolveModule (node_modules/@nuxt/kit/dist/index.mjs:233:12)

Use the @dcrall/tw-test package to illustrate the current module's
inability to import a Tailwind stylesheet from a package.

Logging statement added to the else clause that loads the module's
default CSS file shows the package's tailwind.css is not resolved
and is not loaded.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant