dojo / cli-build-webpack

🚀 **DEPRECATED** Dojo 2 - cli command for building applications
http://dojo.io
Other
4 stars 19 forks source link

.m.css files not required to .m.css.js #225

Closed devpaul closed 6 years ago

devpaul commented 7 years ago

Bug

.m.css files from @dojo/widgets are not being included in a built project. I've tracked down the issue a bit and found that the build process should be including require statements on the top of .m.css.js files. I've attached a zip of three profile.json files produced during a debugged build. profile-expected.json is of a working build and the other two are from my Windows and Mac machines; both exhibit the same issue.

Package Version: ~0.1.0 Node version: 6.11.3 npm version: 4.6.1

Code

built using ./node_modules/.bin/dojo build --debug --element=src/createPlayerElement.ts and used WebPack analyzer to view the profile.json.

Expected behavior:

This is the expected output of ./~/@dojo/widgets/slider/styles/slider.m.css.js. A require statement is added to the top of the file, which informs webpack to include the css file as a dependency.

require('/player/node_modules/@dojo/widgets/slider/styles/slider.m.css');
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
    define([], function () { return (factory()); });
} else if (typeof module === 'object' && module.exports) {
    module.exports = factory();
}
}(this, function () {
    return {"root":"jsR8G-wF","rootFixed":"_2Il2tPLe","inputWrapper":"_7gtF8GBi","inputWrapperFixed":"_1jutPfif","track":"_1pBBSyD7","trackFixed":"_3pPQuSpx","fill":"_2ayuBz7p","fillFixed":"_1MyjV5_F","thumb":"Xqdhlzk8","thumbFixed":"k3G_rSOO","input":"_3eUIrvPR","output":"L5G7P_yQ","outputTooltip":"PgdDVB4h","vertical":"_1lvV4OnP","disabled":"_1RNqpD72","readonly":"_3hOznbkz","required":"_20VqZWur","invalid":"_2MOSl4o_","valid":"_2lyBPY94","nativeInput":"_2s0Axahi"," _key":"dojo-slider"};
}));;

Actual behavior:

The require statement is not added.

(function (root, factory) {
if (typeof define === 'function' && define.amd) {
    define([], function () { return (factory()); });
} else if (typeof module === 'object' && module.exports) {
    module.exports = factory();
}
}(this, function () {
    return {"root":"jsR8G-wF","rootFixed":"_2Il2tPLe","inputWrapper":"_7gtF8GBi","inputWrapperFixed":"_1jutPfif","track":"_1pBBSyD7","trackFixed":"_3pPQuSpx","fill":"_2ayuBz7p","fillFixed":"_1MyjV5_F","thumb":"Xqdhlzk8","thumbFixed":"k3G_rSOO","input":"_3eUIrvPR","output":"L5G7P_yQ","outputTooltip":"PgdDVB4h","vertical":"_1lvV4OnP","disabled":"_1RNqpD72","readonly":"_3hOznbkz","required":"_20VqZWur","invalid":"_2MOSl4o_","valid":"_2lyBPY94","nativeInput":"_2s0Axahi"," _key":"dojo-slider"};
}));

profiles.zip

tomdye commented 7 years ago

The requiring of the m.css file is done by the css-modules build and via a replacement plugin also so I think that adding an extra require would cause it to load it twice. Or are you saying that that process fails for just this file on your machine?

devpaul commented 7 years ago

The require statement is prefixed to the start of *.m.css.js files as part of a working dojo build process. The code snippets I provided are for slider.m.css.js as reported by WebPack in it's debug output. All of my *.m.css.js that are included in the build are missing the require line and as a result you'll see that there's no dependency anywhere for widget-core's slider.m.css (or other widget-core css).

If you download the zip and look at the profiles in WebPack analyzer it's a little easier to read.

Missing css dependency:

screen shot 2017-10-18 at 6 01 36 pm

Expected:

screen shot 2017-10-18 at 6 03 19 pm
kitsonk commented 6 years ago

@devpaul @tomdye has this been addressed?

agubler commented 6 years ago

@devpaul Can you confirm if this is still an issue using cli-build-app and cli-build-widget? If so can you move the issue to one or both of them?

devpaul commented 6 years ago

I'll check and update the ticket.

agubler commented 6 years ago

Closing this until we hear further information, this has not been reproducible for any one else at the moment. If this is still an issue on cli-build-app or cli-build-widget please create issues against the repositories.