From 4ca87d0f15e70b2d586a96fb62db4fc2b99b0102 Mon Sep 17 00:00:00 2001 From: a Date: Fri, 31 Jul 2020 00:29:40 +0200 Subject: [PATCH] Add raw loader for scss --- package.json | 1 + src/types.d.ts | 5 +++++ webpack.config.js | 13 +++++++++---- yarn.lock | 8 ++++++++ 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 164c7a7..836e85e 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "husky": ">=4", "lint-staged": ">=10", "prettier": "^2.0.5", + "raw-loader": "^4.0.1", "sass": "^1.26.10", "sass-loader": "^9.0.2", "style-loader": "^1.2.1", diff --git a/src/types.d.ts b/src/types.d.ts index 4e53c51..c8ec08e 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -1,3 +1,8 @@ +declare module "*.raw" { + const content: string; + export = content; +} + declare const enum commands { setEnabled = "toggleCommand", getEnabled = "getEnabled", diff --git a/webpack.config.js b/webpack.config.js index 3bff0ad..7c1a4c0 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -10,7 +10,12 @@ let mode = process.env.NODE_ENV || "development"; let options = { entry: { popup: path.join(__dirname, "src", "popup", "popup.ts"), - content_script: path.join(__dirname, "src", "content_script.ts"), + content_script: path.join( + __dirname, + "src", + "content_script", + "content_script.ts" + ), background: path.join(__dirname, "src", "background.ts"), }, output: { @@ -35,11 +40,11 @@ let options = { exclude: /node_modules/, }, { - test: /\.css$/i, - use: ["style-loader", "css-loader"], + test: /\.(c|s[ac])ss\.raw$/i, + use: ["raw-loader", "sass-loader"], }, { - test: /\.s[ac]ss$/i, + test: /\.(c|s[ac])ss$/i, use: ["style-loader", "css-loader", "sass-loader"], }, ], diff --git a/yarn.lock b/yarn.lock index 959c920..c6e33fb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5038,6 +5038,14 @@ randomfill@^1.0.3: randombytes "^2.0.5" safe-buffer "^5.1.0" +raw-loader@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/raw-loader/-/raw-loader-4.0.1.tgz#14e1f726a359b68437e183d5a5b7d33a3eba6933" + integrity sha512-baolhQBSi3iNh1cglJjA0mYzga+wePk7vdEX//1dTFd+v4TsQlQE0jitJSNF1OIP82rdYulH7otaVmdlDaJ64A== + dependencies: + loader-utils "^2.0.0" + schema-utils "^2.6.5" + rc@^1.2.8: version "1.2.8" resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed"