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
Add config option #157
Comments
We don’t need multiple configs anymore https://github.com/postcss/postcss-loader#plugins |
Is there a way to specify the postcss config location as even with adding the configuration to webpack 2 {
test: /\.(css|scss)$/,
use: [
{ loader: 'style-loader' },
{ loader: 'css-loader' },
{
loader: 'postcss-loader',
options: {
plugins: function () {
return [
require('autoprefixer')({
browsers: [
'>1%',
'last 3 versions',
'Firefox ESR',
'not ie < 9', // React doesn't support IE8 anyway
]
})
];
}
}
},
{
loader: 'sass-loader',
options: {
importLoaders: true
}
}
]
}, Im still getting an error saying |
@samjbmason please, debug what you have here in |
@ai Im not sure I follow what your asking for |
@samjbmason open plugin code in |
Ah right yeah sure thing undefined { devtool: 'cheap-module-source-map',
entry:
[ '/Users/samm/Sites/lmn-webpack-config/node_modules/react-dev-utils/webpackHotDevClient.js',
'./src/js/main.js' ],
output:
{ pathinfo: true,
path: '/Users/samm/Sites/design-system/build',
publicPath: '/',
filename: 'bundle.js',
chunkFilename: '[id].bundle.js',
library: '',
hotUpdateFunction: 'webpackHotUpdate',
jsonpFunction: 'webpackJsonp',
libraryTarget: 'var',
sourceMapFilename: '[file].map[query]',
hotUpdateChunkFilename: '[id].[hash].hot-update.js',
hotUpdateMainFilename: '[hash].hot-update.json',
crossOriginLoading: false,
hashFunction: 'md5',
hashDigest: 'hex',
hashDigestLength: 20,
devtoolLineToLine: false,
strictModuleExceptionHandling: false },
resolve:
{ extensions: [ '.js', '.json', '.scss' ],
alias:
{ component: '/Users/samm/Sites/design-system/node_modules/@lostmyname/components/dist',
chameleon: '/Users/samm/Sites/design-system/node_modules/chameleon-sass/assets/stylesheets',
css: '/Users/samm/Sites/design-system/node_modules/@lostmyname/css/scss',
fonts: '/Users/samm/Sites/design-system/node_modules/@lostmyname/css/fonts',
scss: '/Users/samm/Sites/design-system/src/scss',
helpers: '/Users/samm/Sites/design-system/src/js/helpers' },
modules:
[ '/Users/samm/Sites/design-system/src',
'node_modules',
'/Users/samm/Sites/design-system/node_modules' ],
unsafeCache: true,
aliasFields: [ 'browser' ],
mainFields: [ 'browser', 'module', 'main' ] },
resolveLoader:
{ modules: [ '/Users/samm/Sites/lmn-webpack-config/node_modules' ],
unsafeCache: true,
mainFields: [ 'loader', 'main' ],
extensions: [ '.js', '.json' ] },
module:
{ rules: [ [Object], [Object], [Object], [Object], [Object], [Object] ],
unknownContextRequest: '.',
unknownContextRegExp: false,
unknownContextRecursive: true,
unknownContextCritical: true,
exprContextRequest: '.',
exprContextRegExp: false,
exprContextRecursive: true,
exprContextCritical: true,
wrappedContextRegExp: /.*/,
wrappedContextRecursive: true,
wrappedContextCritical: false,
unsafeCache: true },
plugins:
[ OccurrenceOrderPlugin { preferEntry: undefined },
EnvironmentPlugin { keys: [Object] },
HotModuleReplacementPlugin { multiStep: undefined, fullBuildTimeout: 200 } ],
node:
{ fs: 'empty',
net: 'empty',
tls: 'empty',
console: false,
process: true,
global: true,
Buffer: true,
setImmediate: true,
__filename: 'mock',
__dirname: 'mock' },
cache: true,
context: '/Users/samm/Sites/design-system',
target: 'web',
performance:
{ maxAssetSize: 250000,
maxEntrypointSize: 250000,
hints: 'warning' } } |
Additional info is that this is running the latest webpack 2 RC |
Replace it to |
Getting |
Did you put it after 48 line? What output will be for |
@samjbmason Could you try removing the |
Yeah sure did here is the code
|
@michael-ciniawsky seems like it has |
@samjbmason Could you replace line 48 to: var options = params.plugins || loader.postcss || loader.options.postcss; Did it fix build for you? |
@ai Still getting |
@michael-ciniawsky oops, it was webpack plugins :) |
@samjbmason go to webpack team. It is webpack 2 issue or webpack UX issue. /cc @TheLarkInn |
Brilliant thanks, do you know what kind of info they will need when I log the issue? |
@samjbmason they will need your full config, full webpack version and that |
@samjbmason I think issue is locate somewhere here. Does it build correctly without resolve:
{ extensions: [ '.js', '.json', '.scss' ],
alias:
{ component: '/Users/samm/Sites/design-system/node_modules/@lostmyname/components/dist',
chameleon: '/Users/samm/Sites/design-system/node_modules/chameleon-sass/assets/stylesheets',
css: '/Users/samm/Sites/design-system/node_modules/@lostmyname/css/scss',
fonts: '/Users/samm/Sites/design-system/node_modules/@lostmyname/css/fonts',
scss: '/Users/samm/Sites/design-system/src/scss',
helpers: '/Users/samm/Sites/design-system/src/js/helpers' },
modules:
[ '/Users/samm/Sites/design-system/src',
'node_modules',
'/Users/samm/Sites/design-system/node_modules' ],
unsafeCache: true,
aliasFields: [ 'browser' ],
mainFields: [ 'browser', 'module', 'main' ] },
resolveLoader:
{ modules: [ '/Users/samm/Sites/lmn-webpack-config/node_modules' ],
unsafeCache: true,
mainFields: [ 'loader', 'main' ],
extensions: [ '.js', '.json' ] }, |
@TheLarkInn maybe I use API in wrong way? But I didn’t found good 2.0 migration guide for loader authors. We load {
loader: 'posctss-loader',
options: {
plugins: [function () { … }]
}
} by |
@samjbmason To my knowledge there is no |
@michael-ciniawsky Yeah it works when i remove |
@samjbmason Yep, I can confirm that's a bug, functions/requires inside of rules.use[index].options are not parsed/loaded at all in Tracking issue is here /cc @sokra @TheLarkInn |
@michael-ciniawsky Unfortunately using a However, I can confirm LoaderOptionsPlugin works for now 👍 Thanks for all your help on this |
@samjbmason Ok I understand, so with |
BTW, we should not use LoaderOptionsPlugin here. Seems like webpack 2 has a issue. If we will fix it by a hack, issue will be released version and many users will get it. So, don't use hack. Create a issue in webpack repo. |
@ai I agree LoaderOPtionsPlugin is not a long term solution but was useful that I could use it, before the bug gets fixed. |
OK, I will add
config
options to set path to PostCSS config :-P.The text was updated successfully, but these errors were encountered: