elm-css-modules-loader
elm-css-modules-loader copied to clipboard
Update dependencies for elm 0.19.1
Updated the dependencies to use elm 0.19.1
To make it really work, elm-css-modules-plugin need to be patched: https://github.com/cultureamp/elm-css-modules-plugin/pull/6
@sentience @zioroboco Any reason this is being held back?
Currently, Elm 0.19.1 users need to fork this repo to get this loader to work. After shuffling for a while, I learned Yarn users can get around this using selective dependency resolution.
Until then, I'll leave this here for other distraught developers that find themselves looking at this PR...
{
"devDependencies": {
"css-loader": "^3.4.2",
"elm": "^0.19.1-3",
"elm-css-modules-loader": "^3.0.4",
"elm-webpack-loader": "^6.0.1",
"style-loader": "^1.1.3",
"webpack": "^4.42.0",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3"
},
// Only available with Yarn
"resolutions": {
"elm-css-modules-loader/elm-css-modules-plugin": "^1.0.2"
}
}
NPM users might also be able to get this to work using npm-force-resolutions, but this in only a workaround.
Short answer for why we haven't moved on this yet is that Culture Amp hasn't upgraded to 0.19.1 yet. We should do that soon, though.
I'll check with @zioroboco to see if merging this in the meantime is an option. (We could stick to the previous version of the package until we're ready to upgrade.)
Thanks for the bump @maxmellen, and thanks @arian!
This is introducing the new plugin version to the loader — looks good to me, and will be compatible with Elm versions 0.18–0.19.1.
If anyone's wondering we don't use this loader internally, but instead use the babel plugin https://github.com/cultureamp/elm-css-modules-plugin directly (with the existing Elm package). This is faster on a large codebases, as it removes unnecessary tokenisation steps from running babel-loader multiple times.
@zioroboco Thanks for the insight! I managed to get elm-css-modules-plugin to work with babel-loader directly.
So if I understand correctly, all elm-css-modules-loader really is is a specialized alternative to babel-loader preconfigured to use elm-css-modules-plugin. Is that correct?
Here's my minimal Webpack 4 config if anyone might wanna take inspiration:
let path = require("path");
let elmCssModulesPlugin = require("elm-css-modules-plugin");
let srcDir = path.resolve(__dirname, "src");
module.exports = {
module: {
rules: [
{
test: /.css$/,
include: srcDir,
use: [
{ loader: "style-loader" },
{ loader: "css-loader", options: { modules: true } }
]
},
{
test: /.elm$/,
include: srcDir,
use: [
{
loader: "babel-loader",
options: { plugins: [elmCssModulesPlugin] }
},
{ loader: "elm-webpack-loader" }
]
}
]
}
};
Would this maybe be worth adding to elm-css-modules-plugin's README? Would you accept a PR for that?
@zioroboco Sorry to reiterate but would you accept a PR to each repo's REAMDEs:
- one on this repo letting people know that
elm-css-modules-plugincan be used directly with Babel rather than throughelm-css-modules-loader - one on
elm-css-modules-pluginshowing basic usage of that plugin with Babel
I'd happily contribute if I get a green light