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

[Bug Report] Raise error when export default used instead of module.exports #332

Closed
akki-jat opened this issue Jul 10, 2018 · 11 comments
Closed

Comments

@akki-jat
Copy link
Contributor

akki-jat commented Jul 10, 2018

What is the current behavior?
Raise error when export default used instead of module.exports.

export default function (css) {
  if (/*@cc_on!@*/false || !!window.document.documentMode) {
    css = css.replace(/var\(--primary-color\)/g, sharedService.primaryColor);
    css = css.replace(/var\(--secondary-color\)/g, sharedService.secondaryColor);
    css = css.replace(/var\(--text-color\)/g, sharedService.textColor);
    css = css.replace(/var\(--grid-col\)/g, sharedService.colsPercentage);
  }

  return css;
} 

If the current behavior is a bug, please provide the steps to reproduce.

Just use export default instead of module.exports

What is the expected behavior?
Should not raise error

Please mention other relevant information such as your webpack version, Node.js version and Operating System.
webpack version : 3.6.0
Node.js version : 8.11.2
OS : Windows 7

Error Screenshots
error_img

error_img_2

error_img_3

Currently using this solution

result = typeof options.transform === 'function'
           ? options.transform(obj.css) 
	   : Object.values(options.transform)[0](obj.css);
@alexander-akait
Copy link
Member

@akki-jat Looks like a bug, feel free to send PR

@sokra
Copy link
Member

sokra commented Jul 10, 2018

Looks like a configuration problem. What's your loader configuration?

@akki-jat
Copy link
Contributor Author

Hi @sokra, here is my loader configuraion

{
    test: /\.css$/,
    use: [
        {
            loader: 'style-loader',
            options: {
                transform: './transform.js'
             }
          },
          {  loader: 'css-loader'  }
    ]
}

@akki-jat
Copy link
Contributor Author

@evilebottnawi and @sokra, any response on this?

@alexander-akait
Copy link
Member

@akki-jat can you create minimum reproducible test repo?

@akki-jat
Copy link
Contributor Author

@evilebottnawi yeah.

@akki-jat
Copy link
Contributor Author

@evilebottnawi here is the repo to reproduce the bug.
https://github.com/akki-jat/style-loader-bug--332

@akki-jat
Copy link
Contributor Author

akki-jat commented Aug 2, 2018

Hi @evilebottnawi any progress on this?

@alexander-akait
Copy link
Member

@akki-jat right now not, very busy, feel free to investigate and send fix

@akki-jat
Copy link
Contributor Author

akki-jat commented Aug 2, 2018

@evilebottnawi I already added fix for this. #333

@akki-jat
Copy link
Contributor Author

akki-jat commented Oct 8, 2018

thanks @michael-ciniawsky & @evilebottnawi .

@akki-jat akki-jat closed this as completed Oct 8, 2018
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