From 22c495b1283678ed7a0080f67ee015c38eb4c17d Mon Sep 17 00:00:00 2001 From: zoomchan-cxj Date: Fri, 23 Jul 2021 15:32:49 +0800 Subject: [PATCH] fix(hippy-vue): fixed vue-css-loader path option for building demo --- .../hippy-vue-demo/scripts/hippy-webpack.android.js | 12 +++++++++++- examples/hippy-vue-demo/scripts/hippy-webpack.ios.js | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/examples/hippy-vue-demo/scripts/hippy-webpack.android.js b/examples/hippy-vue-demo/scripts/hippy-webpack.android.js index c248585317b..5e71d6bf183 100644 --- a/examples/hippy-vue-demo/scripts/hippy-webpack.android.js +++ b/examples/hippy-vue-demo/scripts/hippy-webpack.android.js @@ -8,6 +8,16 @@ const pkg = require('../package.json'); const manifest = require('../dist/android/vendor-manifest.json'); const platform = 'android'; +let cssLoader = '@hippy/vue-css-loader'; +const hippyVueCssLoaderPath = path.resolve(__dirname, '../../../packages/hippy-vue-css-loader/dist/index.js'); +if (fs.existsSync(hippyVueCssLoaderPath)) { + /* eslint-disable-next-line no-console */ + console.warn(`* Using the @hippy/vue-css-loader in ${hippyVueCssLoaderPath}`); + cssLoader = hippyVueCssLoaderPath; +} else { + /* eslint-disable-next-line no-console */ + console.warn('* Using the @hippy/vue-css-loader defined in package.json'); +} module.exports = { mode: 'production', @@ -53,7 +63,7 @@ module.exports = { { test: /\.css$/, use: [ - '@hippy/vue-css-loader', + cssLoader, ], }, { diff --git a/examples/hippy-vue-demo/scripts/hippy-webpack.ios.js b/examples/hippy-vue-demo/scripts/hippy-webpack.ios.js index e75d6cec761..9f4e7f09d9e 100644 --- a/examples/hippy-vue-demo/scripts/hippy-webpack.ios.js +++ b/examples/hippy-vue-demo/scripts/hippy-webpack.ios.js @@ -8,6 +8,16 @@ const pkg = require('../package.json'); const manifest = require('../dist/ios/vendor-manifest.json'); const platform = 'ios'; +let cssLoader = '@hippy/vue-css-loader'; +const hippyVueCssLoaderPath = path.resolve(__dirname, '../../../packages/hippy-vue-css-loader/dist/index.js'); +if (fs.existsSync(hippyVueCssLoaderPath)) { + /* eslint-disable-next-line no-console */ + console.warn(`* Using the @hippy/vue-css-loader in ${hippyVueCssLoaderPath}`); + cssLoader = hippyVueCssLoaderPath; +} else { + /* eslint-disable-next-line no-console */ + console.warn('* Using the @hippy/vue-css-loader defined in package.json'); +} module.exports = { mode: 'production', @@ -53,7 +63,7 @@ module.exports = { { test: /\.css$/, use: [ - '@hippy/vue-css-loader', + cssLoader, ], }, {