Skip to content
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

ローダーのオプション調整に対応 #33

Closed
qrac opened this issue Feb 25, 2022 · 1 comment
Closed

ローダーのオプション調整に対応 #33

qrac opened this issue Feb 25, 2022 · 1 comment

Comments

@qrac
Copy link
Owner

qrac commented Feb 25, 2022

高度なオプションマージ機能を導入して、自前のwebpack.config.jsでローダーのオプションのみを修正できるようにする。

具体的に想定している用途は、CSSの背景画像をバンドルせずpublicから呼び出したい場合。css-loaderに options: { url: false } を設定するだけだが、現状のオプションマージ機能だとルールが重複した場合にユーザー側を無視してしまう。

マージ方法を別の関数に変えるため #15 に影響が出る可能性あり。一応、MiniCssExtractPluginで動作確認済み。

修正後、CSSの背景画像をバンドルせずpublicから呼び出したい場合は自前のwebpack.config.jsに以下を記述することで目的を果たせるようになる。urlをfalseにするかどうかはユーザー次第なので、minista本体では設定しない。

const webpackConfig = {
  module: {
    rules: [
      {
        test: /\.css$/,
        use: [
          {
            loader: "css-loader",
            options: {
              url: false,
            },
          },
        ],
      },
    ],
  },
}

module.exports = webpackConfig
qrac added a commit that referenced this issue Feb 25, 2022
@qrac
Copy link
Owner Author

qrac commented Feb 25, 2022

v1.2.0にて反映。

@qrac qrac closed this as completed Feb 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant