Skip to content

Commit

Permalink
fix all loaders
Browse files Browse the repository at this point in the history
  • Loading branch information
smouillour committed Oct 13, 2023
1 parent 42a0939 commit c2567d8
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 17 deletions.
6 changes: 3 additions & 3 deletions packages/icons/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ module.exports = {
{
// The replacer is used to create relative local paths instead of paths relative
// to publicPath, because it makes it processable by webpack.
loader: 'string-replace-loader',
loader: require.resolve('string-replace-loader'),
options: {
search: /url\(\\"\//g, // The CSS output by css-loader is stringified, so the quotes are escaped
replace: 'url(\\"./',
},
},
{
loader: 'css-loader',
loader: require.resolve('css-loader'),
options: {
url: false,
},
Expand All @@ -44,7 +44,7 @@ module.exports = {
},
{
test: /\.(woff|eot|ttf|svg)$/,
loader: 'url-loader',
loader: require.resolve('url-loader'),
},
],
},
Expand Down
14 changes: 10 additions & 4 deletions packages/storybook-docs/webpack.custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,25 @@ module.exports = {
exclude: /node_modules/,
use: [
{ loader: MiniCssExtractPlugin.loader, options: { esModule: false } },
{ loader: 'css-loader', options: { sourceMap: true } },
{
loader: 'postcss-loader',
loader: require.resolve('css-loader'),
options: { sourceMap: true },
},
{
loader: require.resolve('postcss-loader'),
options: {
postcssOptions: {
plugins: ['autoprefixer'],
sourceMap: true,
},
},
},
{ loader: 'resolve-url-loader', options: { sourceMap: true } },
{
loader: 'sass-loader',
loader: require.resolve('resolve-url-loader'),
options: { sourceMap: true },
},
{
loader: require.resolve('sass-loader'),
options: { sourceMap: true },
},
],
Expand Down
10 changes: 5 additions & 5 deletions packages/theme/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = (env, argv) => {
test: /\.woff(2)?(\?[a-z0-9=&.]+)?$/,
use: [
{
loader: 'file-loader',
loader: require.resolve('file-loader'),
options: {
outputPath: 'fonts',
name: '[name].[ext]',
Expand All @@ -38,17 +38,17 @@ module.exports = (env, argv) => {
test: /bootstrap\.scss$/,
use: [
{
loader: isDev ? 'style-loader' : MiniCssExtractPlugin.loader,
loader: isDev ? require.resolve('style-loader') : MiniCssExtractPlugin.loader,
},
{
loader: 'css-loader',
loader: require.resolve('css-loader'),
options: {
importLoaders: 3,
sourceMap: true,
},
},
{
loader: 'postcss-loader',
loader: require.resolve('postcss-loader'),
options: {
postcssOptions: {
plugins: [postcssPresetEnv({ browsers: 'last 2 versions' })],
Expand All @@ -57,7 +57,7 @@ module.exports = (env, argv) => {
},
},
{
loader: 'sass-loader',
loader: require.resolve('sass-loader'),
options: {
sourceMap: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@ function getCommonStyleLoaders(enableModules, isEnvDevelopmentServe) {
importLoaders: 1,
};
}
const styleLoader = isEnvDevelopmentServe ? 'style-loader' : MiniCssExtractPlugin.loader;
const styleLoader = isEnvDevelopmentServe
? require.resolve('style-loader')
: MiniCssExtractPlugin.loader;
return [
{ loader: styleLoader, options: { esModule: false } },
{ loader: 'css-loader', options: cssOptions },
{ loader: require.resolve('css-loader'), options: cssOptions },
{
loader: 'postcss-loader',
loader: require.resolve('postcss-loader'),
options: {
postcssOptions: {
plugins: ['autoprefixer'],
Expand All @@ -67,9 +69,9 @@ function getJSAndTSLoader() {
function getSassLoaders(enableModules, sassData, isEnvDevelopmentServe) {
const sourceMap = true;
return getCommonStyleLoaders(enableModules, isEnvDevelopmentServe).concat(
{ loader: 'resolve-url-loader', options: { sourceMap } },
{ loader: require.resolve('resolve-url-loader'), options: { sourceMap } },
{
loader: 'sass-loader',
loader: require.resolve('sass-loader'),
options: { sourceMap, additionalData: sassData },
},
);
Expand Down

0 comments on commit c2567d8

Please sign in to comment.