You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using webpack to package my app. When running webpack to build the app, the sass files are throwing errors (below).
webpack
/Users/kyle/Documents/workspace/events/client/wip-components/src/css/events.scss:1
(function (exports, require, module, __filename, __dirname) { @import "_bootstrap";
^
SyntaxError: Unexpected token ILLEGAL
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:413:25)
at Object.Module._extensions..js (module.js:448:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/kyle/Documents/workspace/events/client/wip-components/webpack.config.js:5:1)
at Module._compile (module.js:430:26)
at Object.Module._extensions..js (module.js:448:10)
I am having a similar problem. I'm new to react/webpack/etc, clearly there is something wrong with my config. Having trouble figuring it out.
(function (exports, require, module, __filename, __dirname) { body {
^
SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/home/ian/code/react-isomorphic-boilerplate/lib/shared/components/App.js:31:1)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
Nevermind. My problem was that I was trying to run this on both the client and server for my isomorphic app. It should only be on the client so I added an if (typeof window !== 'undefined') around the require in my js file. Also, I made sure to install css-loader and style-loader in dev dependencies.
Thank you for creating this project!
Reacted by Ryan M, brycesi, Marc , Michael Wheeler and Houider Walid
@kgwinnup Your webpack.config has a dependency which depends on a scss file. @typpo Thanks for pointing that out. Probably a common problem when creating isomorphic/universaljs apps.
Activity
jorrit commentedon Sep 11, 2015
Somehow it is still recognized as javascript. Can you post more config/code?
tomatau commentedon Sep 22, 2015
Same issue here, same sass config. Running JS through babel stage 0.
jorrit commentedon Sep 24, 2015
Can one of you publish a repository that exhibits this problem?
tomatau commentedon Sep 25, 2015
Fixed here - bug my end with WebpackIsomorphicTools.
typpo commentedon Sep 29, 2015
I am having a similar problem. I'm new to react/webpack/etc, clearly there is something wrong with my config. Having trouble figuring it out.
Here is my webpack config: https://github.com/typpo/react-isomorphic-boilerplate/blob/180daca533120b7065ba2f411eae9104002f1a57/webpack.config.dev.js
Here is where I'm including the SCSS: https://github.com/typpo/react-isomorphic-boilerplate/blob/180daca533120b7065ba2f411eae9104002f1a57/src/shared/components/App.jsx#L7
Any thoughts?
typpo commentedon Sep 29, 2015
Nevermind. My problem was that I was trying to run this on both the client and server for my isomorphic app. It should only be on the client so I added an
if (typeof window !== 'undefined')around therequirein my js file. Also, I made sure to installcss-loaderandstyle-loaderin dev dependencies.Thank you for creating this project!
jhnns commentedon Oct 23, 2015
@kgwinnup Your
webpack.confighas a dependency which depends on ascssfile.@typpo Thanks for pointing that out. Probably a common problem when creating isomorphic/universaljs apps.
ryanm2000 commentedon Aug 16, 2016
@typpo's fix, albeit a bit hacky, does the trick.