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

Can't resolve '../../theme.config' #65

Closed
keyvanm opened this issue May 14, 2019 · 2 comments
Closed

Can't resolve '../../theme.config' #65

keyvanm opened this issue May 14, 2019 · 2 comments

Comments

@keyvanm
Copy link

keyvanm commented May 14, 2019

Hi,

Thank you for this amazing library! I am using the official theming guide at https://react.semantic-ui.com/theming to set up theming for my React App. Unfortuantely after following the steps and running npm start I get this error message:

Failed to compile.

./node_modules/semantic-ui-less/semantic.less (./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-8-1!./node_modules/postcss-loader/src??postcss!./node_modules/less-loader/dist/cjs.js??ref--6-oneOf-8-3!./node_modules/semantic-ui-less/semantic.less)

@import (multiple) '../../theme.config';
^
Can't resolve '../../theme.config' in 'PROJECT_DIR/node_modules/semantic-ui-less/definitions/modules'
      in PROJECT_DIR/node_modules/semantic-ui-less/definitions/modules/transition.less (line 19, column 0)

It seems like the alias defined in craco.config.js isn't being picked up.

  webpack: {
    alias: {
      '../../theme.config$': require('path').resolve(
        __dirname,
        '/src/semantic-ui/theme.config',
      ),
    },
  },

It might be related to #6

@keyvanm
Copy link
Author

keyvanm commented May 14, 2019

Fixed! It should be path.join() rather than path.resolve()

  webpack: {
    alias: {
      '../../theme.config$': require('path').join(
        __dirname,
        '/src/semantic-ui/theme.config',
      ),
    },
  },

@keyvanm keyvanm closed this as completed May 14, 2019
@Terranslayer
Copy link

Terranslayer commented Aug 30, 2021

Hi, I have the exact same issue, but in the official theming guide I do not see any requirement of alias define. I tried to do this:

module.exports = {
  webpack: {
    alias: {
      '../../theme.config$': require('path').join(
        __dirname,
        '/src/semantic-ui/theme.config',
      ),
    },
  },
  plugins: [{ plugin: require('@semantic-ui-react/craco-less') }],
}

but still got the same problem, what is worng?

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

No branches or pull requests

2 participants