From 9e97cb12c017da78571e1878c39b05034a080a18 Mon Sep 17 00:00:00 2001 From: daychongyang Date: Fri, 29 May 2020 11:55:07 +0800 Subject: [PATCH] fix: support reference a scss files which installed to node_modules(#291) --- playground/main.js | 3 +++ playground/package.json | 5 +++-- playground/styles/style.scss | 1 + playground/yarn.lock | 5 +++++ src/node/utils/cssUtils.ts | 5 ++++- 5 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 playground/styles/style.scss diff --git a/playground/main.js b/playground/main.js index 168f67249e41a7..7726cc065907ea 100644 --- a/playground/main.js +++ b/playground/main.js @@ -2,4 +2,7 @@ import { createApp } from 'vue' import App from './App.vue' import './testHmrManual' +// test for sass @import +// import './styles/style.scss' + createApp(App).mount('#app') diff --git a/playground/package.json b/playground/package.json index 799f22a07870f8..8e7a93fe2e61bb 100644 --- a/playground/package.json +++ b/playground/package.json @@ -5,9 +5,10 @@ "serve": "serve dist" }, "dependencies": { + "bootstrap": "^4.5.0", + "conditional-exports": "link:./conditional-exports", "lodash-es": "link:../node_modules/lodash-es", "moment": "link:../node_modules/moment", - "rewrite-optimized-test-package": "link:./rewrite-optimized/test-package", - "conditional-exports": "link:./conditional-exports" + "rewrite-optimized-test-package": "link:./rewrite-optimized/test-package" } } diff --git a/playground/styles/style.scss b/playground/styles/style.scss new file mode 100644 index 00000000000000..54adde9c7a378d --- /dev/null +++ b/playground/styles/style.scss @@ -0,0 +1 @@ +@import 'bootstrap/scss/bootstrap'; diff --git a/playground/yarn.lock b/playground/yarn.lock index 21df6cb7719374..85121d63f068f9 100644 --- a/playground/yarn.lock +++ b/playground/yarn.lock @@ -2,6 +2,11 @@ # yarn lockfile v1 +bootstrap@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-4.5.0.tgz#97d9dbcb5a8972f8722c9962483543b907d9b9ec" + integrity sha512-Z93QoXvodoVslA+PWNdk23Hze4RBYIkpb5h8I2HY2Tu2h7A0LpAgLcyrhrSUyo2/Oxm2l1fRZPs1e5hnxnliXA== + "conditional-exports@link:./conditional-exports": version "0.0.0" uid "" diff --git a/src/node/utils/cssUtils.ts b/src/node/utils/cssUtils.ts index 5f7a670a5e1216..cbccd2d7746e40 100644 --- a/src/node/utils/cssUtils.ts +++ b/src/node/utils/cssUtils.ts @@ -78,7 +78,10 @@ export async function compileCss( postcssOptions: postcssConfig.options, postcssPlugins: postcssConfig.plugins } - : {}) + : {}), + preprocessOptions: { + includePaths: ['node_modules'] + } }) }