Closed konradzuwala closed 7 years ago
Just a comment that this error indicates that the SASS file is evaluated as JavaScript so my guess is that it's a problem with webpack loader configuration i.e. the SASS loader does not kick in.
Is it a bug from my side? I mean, in a config file for instance? Or it should go automatically? Edit: Here is my roc.config.js (after migrating it from alpha):
module.exports = {
settings: {
runtime: {
applicationName: 'ABC',
port: 4200,
serve: ['public', 'build/client'],
favicon: 'favicon.png',
template: {
path: 'views',
},
},
build: {
reducers: 'app/redux/reducers.js',
redux: {
middlewares: 'app/redux/middlewares.js'
},
routes: 'app/routes/index.js',
disableProgressbar: true,
},
dev: {
browsersync: {
options: {
open: true
}
}
}
}
};
package.json:
{
"name": "roc-0",
"version": "1.0.0",
"description": "Roc lab 0",
"author": "XYZ",
"license": "MIT",
"scripts": {
"build": "roc build",
"dev": "roc dev",
"start": "roc start",
"lint": "eslint .",
"test": "roc test --test-web-src-path tests/",
"test:watch": "roc test --test-web-src-path tests/ --watch",
"test:cli": "babel-node ./scripts/browser-free.js",
"push:stage": "rsync -ar . oc-stage:www/ --exclude node_modules/ --exclude coverage/ --exclude build/ --exclude scripts/ && rsync -ar scripts/ oc-stage:bin/",
"deploy:stage": "npm run push:stage && ssh oc-stage bin/stage-rebuild-restart"
},
"dependencies": {
"altered.js": "^0.8.6",
"base-64": "^0.1.0",
"immutable": "^3.8.1",
"react-tap-event-plugin": "^1.0.0",
"roc-package-web-app-react": "^1.0.0-beta.3",
"roc-plugin-test-mocha-karma-webpack": "^1.0.0-beta.3"
},
"devDependencies": {
"babel": "^6.5.2",
"babel-cli": "^6.7.7",
"babel-eslint": "6.0.2",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
"babel-preset-stage-0": "^6.5.0",
"chai": "^3.5.0",
"chai-as-promised": "^5.3.0",
"chai-immutable": "^1.5.4",
"enzyme": "^2.3.0",
"eslint": "2.6.0",
"eslint-config-airbnb": "6.2.0",
"eslint-plugin-react": "4.2.3",
"gulp": "^3.9.1",
"ignore-styles": "^4.0.0",
"interact.js": "^1.2.6",
"isomorphic-fetch" : "^2.2.1",
"marked": "^0.3.5",
"moment": "^2.15.1",
"react-addons-test-utils": "^15.1.0",
"react-calendar-timeline": "^0.8.6",
"react-date-picker": "^5.3.28",
"react-dnd": "^2.1.4",
"react-dnd-html5-backend": "^2.1.2",
"react-scroll": "^1.4.0",
"roc-package-web-app-react-dev": "^1.0.0-beta.3",
"roc-plugin-style-sass": "^1.0.0-beta.3",
"trepanjs": "^0.2.5"
}
}
I see that you are not loading the SCSS file from your code. It's the react-calendar-timeline (source) which does that.
Do you use roc-plugin-style-sass? Did you upgrade that as well?
I think this might be because we fixed a bug where styles where incorrectly managed on the server side, we processed more things than we should have had which could result in unwanted behaviours.
This module, react-calendar-timeline
, assumes that the context that loads it have a way to load stylesheets something that the server/Node does not have by default.
In general it is good to not make assumptions like this in modules but we can work around this in a couple of ways.
The easiest thing to do is to tell Webpack to include the module on the server.
module.exports = {
project: {
actions: [{
hook: 'build-webpack',
action: () => () => (webpackConfig) => {
webpackConfig.externals.unshift({
// This will make Webpack include the module in the server build and process all require:s
'react-calendar-timeline': false,
});
return webpackConfig;
},
}],
},
};
That fixed it, thank you! We also did a fix by making a fork of their git and changing it in their sources, but I like that solution much more :) Thank you!
Hello again! We recently migrated our ROC environment from alpha to beta.3. After changing config file we encountered issue with sass. We use react calendar component: https://github.com/namespace-ee/react-calendar-timeline. It worked totally fine with alpha, but when we migrated to beta.3 we have following problem:
The file, Timeline.scss looks ok:
My guess is that plugin for SASS has changed and now it doesn't properly validate file. Or is it maybe something else? Thank you again for help!