When I build my app using ionic run android using Rollup as the bundler, the app's custom CSS is missing and everything looks bad.
I am currently seeing this issue on Windows 10, so that may be relevant. I have attempted to replicate this on iOS with my Mac, but that seems to work fine. I have not tried Webpack on either system. I have tested this on @ionic/[email protected] and everything works correctly.
The app's custom CSS should be included in the Android package.
Steps to reproduce:
ionic start test --v2 --ts)@ionic/app-scripts/@0.0.43src/pages/home/home.scss:page-home {
.content-ios,
.content-md {
background-color: red;
}
}
ionic run android). For my example, the background of the home page should be red, but it will be white instead.insert any relevant code between the above and below backticks
Which @ionic/app-scripts version are you using?
0.0.43
Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)
Ever since they moved to 0.4+ i am also having problems with roll-up.
Same problem. with both 0.0.43 & 0.0.44
ionic-app-scripts build --bundler webpack will output the right css.
i am having the same issue with 0.0.46 and rollup, with webpack works fine
It's caused by bundle.modules of rollup, the path on Windows is something like \rootpath\path\ but not D:\rootpath\path.
So the finding in replace logic will not work. ( https://github.com/driftyco/ionic-app-scripts/blob/master/src/sass.ts#L163 )
Wish this info will help you guys to fix this bug.
Our temporary solution was adding the following line to sass.ts:
function addComponentSassFiles(componentPath: string, collectedSassFiles: string[], context: BuildContext, sassConfig: SassConfig) {
let siblingFiles = getSiblingSassFiles(componentPath, sassConfig);
if (!siblingFiles.length && componentPath.indexOf(sep + 'node_modules') === -1) {
// if we didn't find anything, see if this module is mapped to another directory
for (const k in sassConfig.directoryMaps) {
if (sassConfig.directoryMaps.hasOwnProperty(k)) {
var actualDirectory = replacePathVars(context, k);
var mappedDirectory = replacePathVars(context, sassConfig.directoryMaps[k]);
componentPath = path_1.resolve(componentPath); //Line added
componentPath = componentPath.replace(actualDirectory, mappedDirectory);
siblingFiles = getSiblingSassFiles(componentPath, sassConfig);
if (siblingFiles.length) {
break;
}
}
}
}
This is just happening on windows, on Mac env is working properly.
This is working now with latest version (0.0.47)
https://github.com/driftyco/ionic-app-scripts/releases/tag/v0.0.47
This should be resolved in 1.0.0. Please let me know if it's not.
Thanks,
Dan
Most helpful comment
It's caused by bundle.modules of rollup, the path on Windows is something like
\rootpath\path\but notD:\rootpath\path.So the finding in replace logic will not work. ( https://github.com/driftyco/ionic-app-scripts/blob/master/src/sass.ts#L163 )
Wish this info will help you guys to fix this bug.