Closed hirenchauhan2 closed 8 years ago
Easy fix. I just updated the repo. If you check bc09176ff9d09538ca902677df6be7454cd1a342 it shows what line needs to be modified.
Sorry about that.
Now getting errors for style-loader
in /node_modules/style-loader/addStyles.js
isOldIE = memoize(function() {
return false;
// return /msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase()); // error window is not defined!
}),
getHeadElement = memoize(function () {
return document.head || document.getElementsByTagName("head")[0]; // error document is not defined!
}),
Also found in that same file:
````js
module.exports = function(list, options) {
if(typeof DEBUG !== "undefined" && DEBUG) {
if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
}
......
As we know window is not available in Node globals. So how can we mimic window object in node env?
Now getting errors for style-loader
in /node_modules/style-loader/addStyles.js
isOldIE = memoize(function() {
return false;
// return /msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase()); // error window is not defined!
}),
getHeadElement = memoize(function () {
return document.head || document.getElementsByTagName("head")[0]; // error document is not defined!
}),
Also found in that same file:
module.exports = function(list, options) {
if(typeof DEBUG !== "undefined" && DEBUG) {
if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
}
......
As we know window is not available in Node globals. So how can we mimic window object in node env?
Took me a few minutes to figure out what I think you're trying to do. Let me know if Im off.
Wallop, contains its own set of stylesheets, so when you're importing it into your application, Webpack attempts to parse the css alongside the js.
Look in the webpack.config.client.js for this section and comment out exclude: /node_modules/
{
test: /\.css$/,
// exclude: /node_modules/,
loader: isDev ?
'style!css?localIdentName=[name]__[local].[hash:base64:5]&modules&sourceMap&-minimize&importLoaders=1!postcss' :
ExtractTextPlugin.extract({
fallbackLoader: 'style',
loader: 'css?modules&sourceMap&importLoaders=1!postcss'
}),
}
That should solve your issue since, webpack will now look in node_modules as a possible area to resolve css files from.
I've already copied and changed ext to .scss
files and placed with my component dir. no probem with that. its still style-loader's problem.
Take a look at https://github.com/harry008/manavjyot repo
I've already copied and changed ext to .scss files and placed with my component dir. no probem with that. its still style-loader's problem. Take a look at https://github.com/harry008/manavjyot repo
I pulled your repo down and played around with it for a little while. I'm somewhat puzzled. By commenting out the imported styles from Contacts and from Donation, it builds fine. Keep those two files imported and it breaks. Everywhere else that has styles imported works how they should.
Yeah, just don't import styles in the component. Import them in the theme/main.scss
file then it works fine. Anyway I can live with this for now. By the way thanks for the support. Great work 👍 😄
No problem at all. Glad I could attempt to help out. I just tried something this morning and it works; you might want to give it a shot...
Instead of naming a sass file as Home.scss
try using a different word other than what the folder / component are named. I wasnt able to do import './Home.scss';
but import './style.scss';
works just fine.
I get this error when I run
npm run build
My
package.json
file: