Skip to content

Commit

Permalink
fix(vue): fix web-renderer script
Browse files Browse the repository at this point in the history
  • Loading branch information
zoomchan-cxj committed Oct 14, 2022
1 parent 1be39dc commit 34cc959
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 25 deletions.
2 changes: 1 addition & 1 deletion examples/hippy-react-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@hippy/react-web": "latest",
"@hippy/rmc-list-view": "latest",
"@hippy/rmc-pull-to-refresh": "latest",
"@hippy/web-renderer": "^0.0.1",
"@hippy/web-renderer": "latest",
"animated-scroll-to": "^2.2.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
Expand Down
2 changes: 1 addition & 1 deletion examples/hippy-vue-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@hippy/vue": "latest",
"@hippy/vue-native-components": "latest",
"@hippy/vue-router": "latest",
"@hippy/web-renderer": "^0.0.1",
"@hippy/web-renderer": "latest",
"core-js": "^3.11.0",
"vue": "^2.6.10",
"vue-router": "^3.1.3"
Expand Down
24 changes: 6 additions & 18 deletions examples/hippy-vue-demo/scripts/hippy-webpack.web-renderer.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,21 @@ if (fs.existsSync(hippyVueLoaderPath)) {
const platform = 'web';
module.exports = {
mode: 'development',
devtool: 'eval-source-map',
watch: true,
watchOptions: {
aggregateTimeout: 1500,
},
bail: true,
devServer: {
port: 3000,
hot: true,
liveReload: true,
client: {
overlay: false,
},
devMiddleware: {
writeToDisk: true,
},
},
devtool: 'source-map',
entry: {
index: ['regenerator-runtime', path.resolve(pkg.webMain)],
},
output: {
// filename: `[name].${platform}.js`,
filename: 'index.bundle.js',
strictModuleExceptionHandling: true,
path: path.resolve(`./dist/${platform}/`),
strictModuleExceptionHandling: true,
globalObject: '(0, eval)("this")',
},
plugins: [
Expand All @@ -62,12 +54,8 @@ module.exports = {
template: path.resolve('./public/web-renderer.html'),
}),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('development'),
HOST: JSON.stringify(process.env.DEV_HOST || '127.0.0.1'),
PORT: JSON.stringify(process.env.DEV_PORT || 3000),
},
__PLATFORM__: null,
'process.env.NODE_ENV': JSON.stringify('development'),
__PLATFORM__: JSON.stringify(platform),
}),
new HippyDynamicImportPlugin(),
new CleanWebpackPlugin(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ export default {
line-height: 40px;
}
.async-com-wrapper {
marginTop: 20px
margin-top: 20px;
}
</style>
7 changes: 3 additions & 4 deletions packages/hippy-vue/src/renderer/element-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
/* eslint-disable no-underscore-dangle */
/* eslint-disable no-param-reassign */

import colorParser from '@css-loader/color-parser';
import { PROPERTIES_MAP } from '@css-loader/css-parser';
import { getViewMeta, normalizeElementName } from '../elements';
import {
Expand Down Expand Up @@ -116,14 +115,14 @@ function getLinearGradientColorStop(value) {
const percentageCheckReg = /^([+-]?\d+\.?\d*)%$/g;
if (color && !percentageCheckReg.exec(color) && !percentage) {
return {
color: colorParser(color),
color: Native.parseColor(color),
};
}
if (color && percentageCheckReg.exec(percentage)) {
return {
// color stop ratio
ratio: parseFloat(percentage.split('%')[0]) / 100,
color: colorParser(color),
color: Native.parseColor(color),
};
}
warn('linear-gradient color stop is invalid');
Expand Down Expand Up @@ -402,7 +401,7 @@ class ElementNode extends ViewNode {
value = value.trim();
// Convert inline color style to int
if (key.toLowerCase().indexOf('color') >= 0) {
value = colorParser(value, Native.Platform);
value = Native.parseColor(value);
// Convert inline length style, drop the px unit
} else if (endsWith(value, 'px')) {
value = parseFloat(value.slice(0, value.length - 2));
Expand Down

0 comments on commit 34cc959

Please sign in to comment.