swashata / wp-webpack-script

💥🔥📦👩‍💻 An easy to use, pre configured, hackable webpack setup & development server for WordPress themes and plugins.
https://wpack.io
MIT License
408 stars 57 forks source link

JavaScript code is not working, but importing SASS file from JavaScript itself works? #1176

Closed KoichaDev closed 3 years ago

KoichaDev commented 3 years ago

Right, this might sound weird. I have an index.js file that works if I do import './sass/main.scss';

If I try to do console.log('test')or alert('test') on the index.js, then it's not working at all.

What is the cause of this issue here?

swashata commented 3 years ago

Maybe the file needs to be a module. Try this

export default undefined;

console.log('test');