8000 Aliases not working on windows · Issue #1045 · facebook/stylex · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Aliases not working on windows #1045
Open
@me16eskandari

Description

@me16eskandari

Describe the issue

In my next.js app I configure stylex.js using postcss

babel.config.js

 const path = require("path");
  
  module.exports = {
    presets: ['next/babel'],
    plugins: [
      [
        '@stylexjs/babel-plugin',
        {
          dev: process.env.NODE_ENV === 'development',
          stylexSheetName: '<>',
          runtimeInjection: false,
          genConditionalClasses: true,
          treeshakeCompensation: true,
          aliases: {
            "@/stylex/*": [path.join(__dirname, "src", "stylex", "*")]
          },
          unstable_moduleResolution: {
            type: 'commonJS',
            rootDir: __dirname,
          },
        },
      ],
    ],
  };

postcss.config.js

const babelConfig = require('./babel.config.js');

module.exports = {
    plugins: {
        '@stylexjs/postcss-plugin': {
            include: [
                './**/*.{js,jsx,ts,tsx}',
                // any other files that should be included
                // this should include NPM dependencies that use StyleX
            ],
            useCSSLayers: false,
            babelConfig
        },
    },
};

and I import colors from src/vars.stylex.ts like this
import { colors } from '@/stylex/vars.stylex';

It worked fine on macOs and linux, but got build error on windows
SyntaxError: Could not resolve the path to the imported file. Please ensure that the theme file has a .stylex.js or .stylex.ts file extension and follows the rules for defining variariables:

Expected behavior

It should build successfully on windows,

Steps to reproduce

run yarn build on terminal on windows

Test case

No response

Additional comments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0