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

I want to integrate CKEditor5 in react app with comments feature ejecting the configuration is not an option tried using create-react-app@1 but it's showing the same error. #63

Closed
varunmeka opened this issue Feb 18, 2019 · 14 comments
Labels
resolution:invalid This issue is invalid (e.g. reports a non-existent bug or a by-design behavior).

Comments

@varunmeka
Copy link

varunmeka commented Feb 18, 2019

error:
Module not found: Can't resolve './@ckeditor/ckeditor5-collaboration-core/src/users/users.css' in '/Users/varun.meka/test/node_modules/@ckeditor/ckeditor5-comments/src/sidebar' and i have not ejected any configuration

@pomek
Copy link
Member

pomek commented Feb 18, 2019

Please, create a proper issue that describes what you want to achieve, what did you do in order to get it and what kind of errors are thrown. You can use the Issue template as a pattern if you don't have an idea of how to describe it.

A few days ago we resolved an issue related to Comments feature. You can read more about in #62.

PS: The title of the issue is not the best place for describing the entire problem.

@pomek pomek closed this as completed Feb 18, 2019
@pomek pomek added the resolution:invalid This issue is invalid (e.g. reports a non-existent bug or a by-design behavior). label Feb 18, 2019
@varunmeka
Copy link
Author

Can you please the check the issue I have modified the description

@pomek
Copy link
Member

pomek commented Feb 18, 2019

It looks like Webpack cannot load CSS file. We are aware of this problem.

See this comment – #62 (comment) – I described a solution that should help.

@varunmeka
Copy link
Author

I tried it do I need to add any other variable styles because it throws

err: styles is not defined

@pomek
Copy link
Member

pomek commented Feb 18, 2019

@varunmeka
Copy link
Author

I did the same as mentioned I got this error

./node_modules/@ckeditor/ckeditor5-collaboration-core/src/users/usercolors.css (./node_modules/css-loader!./node_modules/postcss-loader/src!./node_modules/@ckeditor/ckeditor5-collaboration-core/src/users/usercolors.css)
Error: No PostCSS Config found in: /Users/varun.meka/test/node_modules/@ckeditor/ckeditor5-collaboration-core/src/users

@pomek
Copy link
Member

pomek commented Feb 18, 2019

Could you share the configuration that produces the error?

@varunmeka

This comment has been minimized.

@pomek
Copy link
Member

pomek commented Feb 18, 2019

AFAICS:

{ test: /(\.css$)/, loaders: ['style-loader', 'css-loader', 'postcss-loader'] },

catches our styles, so you need to disable it for CKEditor 5 assets:

{ 
    test: /(\.css$)/, 
    exclude: [
        /ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css/,
        /ckeditor5-[^/\\]+[/\\]src[/\\].+\.css/
    ],
    loaders: ['style-loader', 'css-loader', 'postcss-loader'] 
},

Next:

{
  test: /\.css$/,
  exclude: /ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css/,
  // (...)
}

It does nothing. You must remove it.

Next:

// Adds support for CSS Modules (https://github.com/css-modules/css-modules)
// using the extension .module.css
{
  test: cssModuleRegex,
  use: getStyleLoaders({
    importLoaders: 1,
    sourceMap: isEnvProduction
      ? shouldUseSourceMap
      : isEnvDevelopment,
    modules: true,
    getLocalIdent: getCSSModuleLocalIdent,
  }),
},
// Opt-in support for SASS (using .scss or .sass extensions).
// By default we support SASS Modules with the
// extensions .module.scss or .module.sass
{
  test: sassRegex,
  exclude: sassModuleRegex,
  use: getStyleLoaders(
    {
      importLoaders: 2,
      sourceMap: isEnvProduction
        ? shouldUseSourceMap
        : isEnvDevelopment,
    },
    'sass-loader'
  ),
  // Don't consider CSS imports dead code even if the
  // containing package claims to have no side effects.
  // Remove this when webpack adds a warning or an error for this.
  // See https://github.com/webpack/webpack/issues/6571
  sideEffects: true,
},
// Adds support for CSS Modules, but using SASS
// using the extension .module.scss or .module.sass
{
  test: sassModuleRegex,
  use: getStyleLoaders(
    {
      importLoaders: 2,
      sourceMap: isEnvProduction
        ? shouldUseSourceMap
        : isEnvDevelopment,
      modules: true,
      getLocalIdent: getCSSModuleLocalIdent,
    },
    'sass-loader'
  ),
},

Are you sure that you need three another CSS loaders? If so, you must disable CKEditor 5 assets as we did at the beginning of this comment.

If it still does not work, I can't help you because I don't know what to do more. We checked our documentation a few times and it worked for us perfectly. Be sure that you follow the documentation step by step.

@varunmeka
Copy link
Author

Thanks, @pomek It worked

@varunmeka
Copy link
Author

HI @pomek I was going through your custom build documentation and I can't add extra plugins.
Is It possible to add extra plugins/custom build without npm run eject

@pomek
Copy link
Member

pomek commented Feb 19, 2019

If you want to use CKEditor 5 Framework inside the react application, you can't avoid ejecting.

But you can create a custom build in a separate repository and add it as a dependency to the react app. This way you can skip ejecting because the build will be ready-to-use.

@varunmeka
Copy link
Author

So you mean creating a custom build by ejecting the configuration and add it as dependency to the parent react app

@pomek
Copy link
Member

pomek commented Feb 19, 2019

I meant creating a custom build – https://ckeditor.com/docs/ckeditor5/latest/builds/guides/development/custom-builds.html. You can fork a current build, modify to match your requirements, rebuild the package and publish (on GH or even npm).

Then, inside your react app you can add the build as a dependency. In your component, you can just import it and you don't have to think about ejecting the webpack configurations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution:invalid This issue is invalid (e.g. reports a non-existent bug or a by-design behavior).
Projects
None yet
Development

No branches or pull requests

2 participants