Skip to content

Commit

Permalink
fix(example): split js bundle with webpack dllplugin
Browse files Browse the repository at this point in the history
  • Loading branch information
xuqingkuang authored and tsangint committed Feb 21, 2020
1 parent ed45b17 commit c8ac36d
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 138 deletions.
54 changes: 1 addition & 53 deletions examples/android-demo/res/index.android.js

Large diffs are not rendered by default.

Expand Up @@ -24,8 +24,8 @@ module.exports = {
}),
new CaseSensitivePathsPlugin(),
new webpack.DllPlugin({
context: path.resolve('..'),
path: path.resolve(`./dist/${platform}/[name]-manifest.json`),
context: path.resolve(__dirname, '..'),
path: path.resolve(__dirname, `../dist/${platform}/[name]-manifest.json`),
name: 'hippyReactBase',
}),
],
Expand Down
5 changes: 2 additions & 3 deletions examples/hippy-react-demo/scripts/hippy-webpack.android.js
Expand Up @@ -2,8 +2,7 @@ const path = require('path');
const webpack = require('webpack');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
const pkg = require('../package.json');
// eslint-disable-next-line import/no-dynamic-require
const manifest = require(path.resolve('./dist/android/vendor-manifest.json'));
const manifest = require('../dist/android/vendor-manifest.json');

const platform = 'android';

Expand All @@ -26,7 +25,7 @@ module.exports = {
}),
new CaseSensitivePathsPlugin(),
new webpack.DllReferencePlugin({
context: process.cwd(),
context: path.resolve(__dirname, '..'),
manifest,
}),
],
Expand Down
4 changes: 2 additions & 2 deletions examples/hippy-react-demo/scripts/hippy-webpack.ios-vendor.js
Expand Up @@ -24,8 +24,8 @@ module.exports = {
}),
new CaseSensitivePathsPlugin(),
new webpack.DllPlugin({
context: path.resolve('..'),
path: path.resolve(`./dist/${platform}/[name]-manifest.json`),
context: path.resolve(__dirname, '..'),
path: path.resolve(__dirname, `../dist/${platform}/[name]-manifest.json`),
name: 'hippyReactBase',
}),
],
Expand Down
6 changes: 2 additions & 4 deletions examples/hippy-react-demo/scripts/hippy-webpack.ios.js
Expand Up @@ -2,9 +2,7 @@ const path = require('path');
const webpack = require('webpack');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
const pkg = require('../package.json');
// eslint-disable-next-line import/no-dynamic-require
const manifest = require(path.resolve('./dist/ios/vendor-manifest.json'));

const manifest = require('../dist/ios/vendor-manifest.json');

const platform = 'ios';

Expand All @@ -27,7 +25,7 @@ module.exports = {
}),
new CaseSensitivePathsPlugin(),
new webpack.DllReferencePlugin({
context: process.cwd(),
context: path.resolve(__dirname, '..'),
manifest,
}),
],
Expand Down
12 changes: 0 additions & 12 deletions examples/hippy-react-demo/src/components/View/index.jsx
Expand Up @@ -5,7 +5,6 @@ import {
View,
StyleSheet,
} from '@hippy/react';
import MyView from '../../externals/MyView/MyView';

const styles = StyleSheet.create({
itemTitle: {
Expand Down Expand Up @@ -62,17 +61,6 @@ export default function ViewExpo() {
<View style={[styles.smallRectangle, { backgroundColor: 'blue' }]} />
<View style={[styles.smallRectangle, { backgroundColor: 'green' }]} />
</View>
<MyView text="你好,我是MyView" style={{ width: 250, height: 100, color: 'black' }}>
<Text style={{
marginTop: 2,
marginLeft: 2,
fontSize: 8,
color: '#4c9afa',
}}
>
MyView内部的文字
</Text>
</MyView>
</ScrollView>
);
}
Expand Up @@ -26,8 +26,8 @@ module.exports = {
new CaseSensitivePathsPlugin(),
new VueLoaderPlugin(),
new webpack.DllPlugin({
context: path.resolve('..'),
path: path.resolve(`./dist/${platform}/[name]-manifest.json`),
context: path.resolve(__dirname, '..'),
path: path.resolve(__dirname, `../dist/${platform}/[name]-manifest.json`),
name: 'hippyVueBase',
}),
],
Expand Down
5 changes: 2 additions & 3 deletions examples/hippy-vue-demo/scripts/hippy-webpack.android.js
Expand Up @@ -3,8 +3,7 @@ const webpack = require('webpack');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
const pkg = require('../package.json');
// eslint-disable-next-line import/no-dynamic-require
const manifest = require(path.resolve('./dist/android/vendor-manifest.json'));
const manifest = require('../dist/android/vendor-manifest.json');

const platform = 'android';

Expand All @@ -28,7 +27,7 @@ module.exports = {
new CaseSensitivePathsPlugin(),
new VueLoaderPlugin(),
new webpack.DllReferencePlugin({
context: process.cwd(),
context: path.resolve(__dirname, '..'),
manifest,
}),
],
Expand Down
4 changes: 2 additions & 2 deletions examples/hippy-vue-demo/scripts/hippy-webpack.ios-vendor.js
Expand Up @@ -26,8 +26,8 @@ module.exports = {
new CaseSensitivePathsPlugin(),
new VueLoaderPlugin(),
new webpack.DllPlugin({
context: path.resolve('..'),
path: path.resolve(`./dist/${platform}/[name]-manifest.json`),
context: path.resolve(__dirname, '..'),
path: path.resolve(__dirname, `../dist/${platform}/[name]-manifest.json`),
name: 'hippyVueBase',
}),
],
Expand Down
5 changes: 2 additions & 3 deletions examples/hippy-vue-demo/scripts/hippy-webpack.ios.js
Expand Up @@ -3,8 +3,7 @@ const webpack = require('webpack');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
const pkg = require('../package.json');
// eslint-disable-next-line import/no-dynamic-require
const manifest = require(path.resolve('./dist/ios/vendor-manifest.json'));
const manifest = require('../dist/ios/vendor-manifest.json');

const platform = 'ios';

Expand All @@ -28,7 +27,7 @@ module.exports = {
new CaseSensitivePathsPlugin(),
new VueLoaderPlugin(),
new webpack.DllReferencePlugin({
context: process.cwd(),
context: path.resolve(__dirname, '..'),
manifest,
}),
],
Expand Down
53 changes: 1 addition & 52 deletions examples/ios-demo/res/index.ios.js

Large diffs are not rendered by default.

0 comments on commit c8ac36d

Please sign in to comment.