Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Snipaste_2020-05-26_09-22-41.png
用了est样式工具库,文件也引入了。
SyntaxError: Inline JavaScript is not enabled. Is it set in your options?
这个报错是为什么。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
400 views
Welcome To Ask or Share your Answers For Others

1 Answer

const lessRegex = /.less$/;
...

 {
              test: lessRegex,
              use: getStyleLoaders(
                {
                  importLoaders: 2,
                  sourceMap: isEnvProduction && shouldUseSourceMap,
                },
                'less-loader',
                {
                  lessOptions: {
                    javascriptEnabled: true,        // 写上就行了
                    modifyVars: {
                      'primary-color': '#FF8F8D',
                      'link-color': '#FF8F8D',
                      'link-hover-color': '#ff7a45'
                    }
                  }
                }
              ),
              sideEffects: true
            }

以上只是create-react-app脚手架eject后配置的变量,getStyleLoaders函数,接收options选项,如果是一般的脚手架,自己配置options,javascriptEnabled设为 true就行了


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...