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

Enable inline javascript #1

Open
pmkrawczyk opened this issue Jan 6, 2021 · 6 comments
Open

Enable inline javascript #1

pmkrawczyk opened this issue Jan 6, 2021 · 6 comments

Comments

@pmkrawczyk
Copy link

Hi,

I'm trying to enable inline javascript in less by adding the following to docusaurus.config.js:

plugins: [
    ["docusaurus-plugin-sass", {}],
    [
      require.resolve("docusaurus-plugin-less"),
      {
        lessOptions: {
          javascriptEnabled: true,
        },
      },
    ],
  ],

But this does not work, inline javascript throws errors.

By the way, while looking through the plugin code I found this:

const AVAILABLE_LOADER_OPTION_KEYS = [
    'lessOption',
    'additionalData',
    'sourceMap',
    'webpackImporter'
];

As far as I can see, the key should be 'lessOptions' (plural). Changing this does not solve my problem though...

Can anyone help, please?

@pmkrawczyk pmkrawczyk changed the title Enable javascript Enable inline javascript Jan 6, 2021
@nonoroazoro
Copy link
Owner

Can you paste your code (including less) here?

@pmkrawczyk
Copy link
Author

Thank you for your help!

The less file comes from the RSuite, I am trying to import the steps component into docusaurus.

The component imports properly but when I try to import styles using this command:
import "rsuite/lib/Steps/styles";

I get the following error:

.tinyColorMixin();
^
Inline JavaScript is not enabled. Is it set in your options?
      in node_modules\rsuite\lib\styles\mixins\tiny-color.less (line 1183, column 0)

The error is thrown by this command:
.tinyColorMixin();
in this less file.

Is this sufficient information (I'm quite a noob at this!)

@nonoroazoro
Copy link
Owner

@pmkrawczyk Please use the following code to set less-loader options:

plugins: [
    [
      "docusaurus-plugin-less",
      { lessOptions: { javascriptEnabled: true } }
    ]
  ],

@pmkrawczyk
Copy link
Author

Yes, I've tried this syntax as well, I'm afraid ti doesn't work either - I always get the mentioned errors...

@nonoroazoro
Copy link
Owner

It works in my project, weird...

@yijinc
Copy link

yijinc commented Nov 2, 2021

i have the same error 😥

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

3 participants