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

尝试引入less文件,报错 #2

Open
wjun52 opened this issue Apr 27, 2018 · 1 comment
Open

尝试引入less文件,报错 #2

wjun52 opened this issue Apr 27, 2018 · 1 comment

Comments

@wjun52
Copy link

wjun52 commented Apr 27, 2018

ERROR in ../node_modules/_react-photoswipe@1.3.0@react-photoswipe/lib/photoswipe.css
Module build failed: ReferenceError: window is not defined

请问该如何正确引入less

@tzuser
Copy link
Owner

tzuser commented May 2, 2018

我的整个项目都是使用css in js,没有考虑less。你可能需要自己配置webpack。

你可以参考下面代码
npm install --save-dev less-loader less

{
  test:/\.(css|less)$/,
  use: ExtractTextPlugin.extract({
    fallback:'style-loader',//style-loader 将css插入到页面的style标签
    use:[{
      loader: 'css-loader',//css-loader 是处理css文件中的url(),require()等
    },,{
      loader:'less-loader',
    }]
  }),
}

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