-
-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Webpack 2 and plugin loading #149
Comments
I have tried to use the module: {
rules: [
{
test: /\.styl$/,
use: [
{
loader: 'stylus',
options: {
use: bootstrap()
}
}
]
}
]
} Unfortunately the option property seems to get serialized and the function I'm trying to pass is received as null. This might help to find a fix: webpack-contrib/postcss-loader#104 |
@shama, maybe you should create a label Just bumped into a similar problem and found a solution, so I'll post it here for the benefit of the community. Using
Starting from Workaround 2 provided above by @igl, I ended up with this working solution, thanks to @phairoh:
Note the necessary |
I altered the loader in #154 a little so you can use LoaderOptionsPlugin or OptionsPlugin in stylus-loader (a convenience wrapper for LoaderOptionsPlugin) to set |
I've been struggling to figure out how to define my import options with webpack 2, i've attempted to use the stylusOptions method as mentioned in the docs but it does not seem to work. I'm doing this via nuxt.js and initially thought it was something on their end and raised a ticket, but i've not been able to find anything in general about defining options for stylus-loader with webpack 2. Could anyone point me in the right direction please? |
If you add a unique https://webpack.js.org/guides/migrating/#complex-options Example here: webpack-contrib/extract-text-webpack-plugin#265 (comment) |
Problem
Using the options object (
stylus: { ... }
) in webpack2 fails. They validate the config with a schema now.Fix
and/or
allow strings passed to use. Like:
stylus?use=nib
Workaround 1
My workaround was to use the loader-string to inject options:
stylus-loader?' + JSON.stringify(stylusOpts)
This works nicely however i can't use "use" this way:
Workaround 2
The text was updated successfully, but these errors were encountered: