Skip to content

Commit

Permalink
refactor(demo): change vue-loader dependency judgement
Browse files Browse the repository at this point in the history
  • Loading branch information
zoomchan-cxj committed Mar 21, 2023
1 parent cf739c0 commit a5dd1b6
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ const platform = 'android';
let vueLoader = '@hippy/vue-loader';
let VueLoaderPlugin;
const hippyVueLoaderPath = path.resolve(__dirname, '../../../packages/hippy-vue-loader/lib');
if (fs.existsSync(hippyVueLoaderPath)) {
const hippyVueLoaderNodeModulesPath = path.resolve(__dirname, '../../../packages/hippy-vue-loader/node_modules');
if (fs.existsSync(hippyVueLoaderNodeModulesPath) && fs.existsSync(hippyVueLoaderPath)) {
console.warn(`* Using the @hippy/vue-loader in ${hippyVueLoaderPath}`);
vueLoader = hippyVueLoaderPath;
VueLoaderPlugin = require(path.resolve(__dirname, '../../../packages/hippy-vue-loader/lib/plugin'));
Expand Down
3 changes: 2 additions & 1 deletion examples/hippy-vue-demo/scripts/hippy-webpack.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ if (fs.existsSync(hippyVueCssLoaderPath)) {
let vueLoader = '@hippy/vue-loader';
let VueLoaderPlugin;
const hippyVueLoaderPath = path.resolve(__dirname, '../../../packages/hippy-vue-loader/lib');
if (fs.existsSync(hippyVueLoaderPath)) {
const hippyVueLoaderNodeModulesPath = path.resolve(__dirname, '../../../packages/hippy-vue-loader/node_modules');
if (fs.existsSync(hippyVueLoaderNodeModulesPath) && fs.existsSync(hippyVueLoaderPath)) {
console.warn(`* Using the @hippy/vue-loader in ${hippyVueLoaderPath}`);
vueLoader = hippyVueLoaderPath;
VueLoaderPlugin = require(path.resolve(__dirname, '../../../packages/hippy-vue-loader/lib/plugin'));
Expand Down
3 changes: 2 additions & 1 deletion examples/hippy-vue-demo/scripts/hippy-webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ if (fs.existsSync(hippyVueCssLoaderPath)) {
let vueLoader = '@hippy/vue-loader';
let VueLoaderPlugin;
const hippyVueLoaderPath = path.resolve(__dirname, '../../../packages/hippy-vue-loader/lib');
if (fs.existsSync(hippyVueLoaderPath)) {
const hippyVueLoaderNodeModulesPath = path.resolve(__dirname, '../../../packages/hippy-vue-loader/node_modules');
if (fs.existsSync(hippyVueLoaderNodeModulesPath) && fs.existsSync(hippyVueLoaderPath)) {
console.warn(`* Using the @hippy/vue-loader in ${hippyVueLoaderPath}`);
vueLoader = hippyVueLoaderPath;
VueLoaderPlugin = require(path.resolve(__dirname, '../../../packages/hippy-vue-loader/lib/plugin'));
Expand Down
3 changes: 2 additions & 1 deletion examples/hippy-vue-demo/scripts/hippy-webpack.ios-vendor.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ const platform = 'ios';
let vueLoader = '@hippy/vue-loader';
let VueLoaderPlugin;
const hippyVueLoaderPath = path.resolve(__dirname, '../../../packages/hippy-vue-loader/lib');
if (fs.existsSync(hippyVueLoaderPath)) {
const hippyVueLoaderNodeModulesPath = path.resolve(__dirname, '../../../packages/hippy-vue-loader/node_modules');
if (fs.existsSync(hippyVueLoaderNodeModulesPath) && fs.existsSync(hippyVueLoaderPath)) {
console.warn(`* Using the @hippy/vue-loader in ${hippyVueLoaderPath}`);
vueLoader = hippyVueLoaderPath;
VueLoaderPlugin = require(path.resolve(__dirname, '../../../packages/hippy-vue-loader/lib/plugin'));
Expand Down
3 changes: 2 additions & 1 deletion examples/hippy-vue-demo/scripts/hippy-webpack.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ if (fs.existsSync(hippyVueCssLoaderPath)) {
let vueLoader = '@hippy/vue-loader';
let VueLoaderPlugin;
const hippyVueLoaderPath = path.resolve(__dirname, '../../../packages/hippy-vue-loader/lib');
if (fs.existsSync(hippyVueLoaderPath)) {
const hippyVueLoaderNodeModulesPath = path.resolve(__dirname, '../../../packages/hippy-vue-loader/node_modules');
if (fs.existsSync(hippyVueLoaderNodeModulesPath) && fs.existsSync(hippyVueLoaderPath)) {
console.warn(`* Using the @hippy/vue-loader in ${hippyVueLoaderPath}`);
vueLoader = hippyVueLoaderPath;
VueLoaderPlugin = require(path.resolve(__dirname, '../../../packages/hippy-vue-loader/lib/plugin'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ if (fs.existsSync(hippyVueCssLoaderPath)) {
let vueLoader = '@hippy/vue-loader';
let VueLoaderPlugin;
const hippyVueLoaderPath = path.resolve(__dirname, '../../../packages/hippy-vue-loader/lib');
if (fs.existsSync(hippyVueLoaderPath)) {
const hippyVueLoaderNodeModulesPath = path.resolve(__dirname, '../../../packages/hippy-vue-loader/node_modules');
if (fs.existsSync(hippyVueLoaderNodeModulesPath) && fs.existsSync(hippyVueLoaderPath)) {
console.warn(`* Using the @hippy/vue-loader in ${hippyVueLoaderPath}`);
vueLoader = hippyVueLoaderPath;
VueLoaderPlugin = require(path.resolve(__dirname, '../../../packages/hippy-vue-loader/lib/plugin'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ if (fs.existsSync(hippyVueCssLoaderPath)) {
let vueLoader = '@hippy/vue-loader';
let VueLoaderPlugin;
const hippyVueLoaderPath = path.resolve(__dirname, '../../../packages/hippy-vue-loader/lib');
if (fs.existsSync(hippyVueLoaderPath)) {
const hippyVueLoaderNodeModulesPath = path.resolve(__dirname, '../../../packages/hippy-vue-loader/node_modules');
if (fs.existsSync(hippyVueLoaderNodeModulesPath) && fs.existsSync(hippyVueLoaderPath)) {
console.warn(`* Using the @hippy/vue-loader in ${hippyVueLoaderPath}`);
vueLoader = hippyVueLoaderPath;
VueLoaderPlugin = require(path.resolve(__dirname, '../../../packages/hippy-vue-loader/lib/plugin'));
Expand Down

0 comments on commit a5dd1b6

Please sign in to comment.