ng-zorro-antd: Inline JavaScript is not enabled. Is it set in your options?

What problem does this feature solve?

Hi team, I bumped into the following problem and wasn’t able to find a proper place to post the issue. I’m using storybook tool in my project and this is my configuration for it (pls pay attention to less-loader):

module.exports = {
  module: {
    rules: [
      {
        test: /\.less$/i,
        use: [
          {
            loader: "less-loader",
            options: {
              lessOptions: {
                javascriptEnabled: true
              },
            },
          },
        ],
      },
    ],
  },
}

However, when I’m trying to compile the project (npm run storybook) the following ERROR comes up:

.bezierEasingMixin();
^
Inline JavaScript is not enabled. Is it set in your options?

As far as I can see I added { javascriptEnabled: true } option but it did not help. Any ideas on how to troubleshoot the issue?

less@3.5.0 less-loader@7.0.0

What does the proposed API look like?

N/A

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 5
  • Comments: 23 (6 by maintainers)

Most upvoted comments

Still have this problem even after updating ant design to version 16

X [ERROR] Inline JavaScript is not enabled. Is it set in your options? [plugin angular-less]

    node_modules/ng-zorro-antd/style/color/bezierEasing.less:110:0:
      110 │ .bezierEasingMixin();

This is the singular error hindering my project’s compatibility with ES Build. Could you let me know if there are any plans to address this issue in the near future?

I also have this error, but because i use @angular-devkit/build-angular:browser-esbuild to builder it is angular docs:https://angular.io/guide/esbuild

This issue is already open for 2 years. Any updates? It should be fixed before Angular drops support for this flag.

Still have this problem even after updating ant design to version 16 image

I encountered the same problem when testing esbuild from angular v16. The response of the issue angular-cli:

The javascriptEnabled option is deprecated by Less and is not recommended due to security concerns. This was actually discussed in 2018 (Angular v6 timeframe) in regards to what appears to be the same package (https://github.com/angular/angular-cli/issues/10430). Due to potential security concerns with users unintentionally executing JS at build time, further discussion with the team will be needed to determine a long-term path forward.