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

fix: js project error #3655

Merged
merged 3 commits into from
Oct 14, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/icejs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ice.js",
"version": "1.9.7",
"version": "1.9.8",
"description": "command line interface and builtin plugin for icejs",
"author": "ice-admin@alibaba-inc.com",
"homepage": "",
Expand Down Expand Up @@ -34,7 +34,7 @@
"build-plugin-ice-router": "1.7.3",
"build-plugin-ice-ssr": "1.7.3",
"build-plugin-ice-store": "1.7.6",
"build-plugin-react-app": "1.7.7",
"build-plugin-react-app": "1.7.8",
"build-plugin-miniapp": "0.1.6",
"create-cli-utils": "0.1.4",
"chokidar": "^3.3.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-app-base/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-app-base",
"version": "1.0.3",
"version": "1.0.4",
"description": "rax app base plugin",
"main": "lib/index.js",
"scripts": {
Expand Down
12 changes: 8 additions & 4 deletions packages/plugin-app-base/src/setDev.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ module.exports = function(api) {
const debug = require('debug')('rax-app');
const { context, onHook } = api;
const { commandArgs, userConfig, rootDir } = context;
const { targets } = userConfig;
const { targets} = userConfig;
let webEntryKeys = [];
let weexEntryKeys = [];
let webMpa = false;
let weexMpa = false;
const getWebpackEntry = (configs, configName) => {
const taskConfig = configs.find((webpackConfig) => webpackConfig.name === configName);
if (!taskConfig || !taskConfig.entry) {
Expand All @@ -33,8 +35,10 @@ module.exports = function(api) {
onHook('before.start.run', ({ config }) => {
webEntryKeys = Object.keys(getWebpackEntry(config, 'web'));
weexEntryKeys = Object.keys(getWebpackEntry(config, 'weex'));
webMpa = userConfig.web && userConfig.web.mpa;
weexMpa = userConfig.weex && userConfig.weex.mpa;
try {
debug(config[0]);
debug(config);
// eslint-disable-next-line no-empty
} catch (err) {}
});
Expand Down Expand Up @@ -109,7 +113,7 @@ module.exports = function(api) {
if (targets.includes(WEB)) {
console.log(highlightPrint(' [Web] Development server at: '));
webEntryKeys.forEach((entryKey) => {
const entryPath = webEntryKeys.length > 1 ? `${entryKey}.html` : '';
const entryPath = webMpa ? `${entryKey}.html` : '';
console.log(` ${chalk.underline.white(`${getLocalUrl(urls.localUrlForBrowser)}${entryPath}`)}`);
console.log(` ${chalk.underline.white(`${getLocalUrl(urls.lanUrlForBrowser)}${entryPath}`)}`);
console.log();
Expand All @@ -130,7 +134,7 @@ module.exports = function(api) {
// Use Weex App to scan ip address (mobile phone can't visit localhost).
console.log(highlightPrint(' [Weex] Development server at: '));
weexEntryKeys.forEach((entryKey) => {
const weexUrl = `${urls.lanUrlForBrowser}weex/${weexEntryKeys.length > 1 ? entryKey : 'index'}.js?wh_weex=true`;
const weexUrl = `${urls.lanUrlForBrowser}weex/${weexMpa ? entryKey : 'index'}.js?wh_weex=true`;
console.log(` ${chalk.underline.white(weexUrl)}`);
console.log();
qrcode.generate(weexUrl, { small: true });
Expand Down
8 changes: 7 additions & 1 deletion packages/plugin-app-base/src/utils/polyfillLoader.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
module.exports = (content) => {
const { extname } = require('path');

module.exports = function(content) {
// Polyfill code needn't be added into json file.
if (extname(this.resourcePath) === '.json') {
return content;
}
return `
import "core-js/stable";
import "regenerator-runtime/runtime";
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-react-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-react-app",
"version": "1.7.7",
"version": "1.7.8",
"description": "The basic webpack configuration for ice project",
"author": "ice-admin@alibaba-inc.com",
"main": "src/index.js",
Expand Down
8 changes: 7 additions & 1 deletion packages/plugin-react-app/src/utils/polyfillLoader.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
module.exports = (content) => {
const { extname } = require('path');

module.exports = function(content) {
// Polyfill code needn't be added into json file.
if (extname(this.resourcePath) === '.json') {
return content;
}
return `
import "core-js/stable";
import "regenerator-runtime/runtime";
Expand Down
4 changes: 2 additions & 2 deletions packages/rax-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rax-app",
"version": "3.0.2",
"version": "3.0.3",
"description": "command line interface and builtin plugin for rax app",
"author": "ice-admin@alibaba-inc.com",
"homepage": "https://github.com/alibaba/ice#readme",
Expand All @@ -17,7 +17,7 @@
"@alib/build-scripts": "^0.1.24",
"build-plugin-app-core": "0.1.20",
"build-plugin-ice-store": "1.7.6",
"build-plugin-app-base": "1.0.3",
"build-plugin-app-base": "1.0.4",
"build-plugin-rax-web": "1.0.3",
"build-plugin-rax-weex": "1.0.3",
"build-plugin-rax-kraken": "1.0.2",
Expand Down