diff --git a/package.json b/package.json index 383baaf..849f6ba 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "re:start": "rescript build -w", "re:format": "rescript format -all", "web": "webpack serve --mode=development --config reactNativeWeb/webpack.config.js", + "web:demo" : "concurrently \" yarn web\" \" webpack server --mode=development --config reactNativeWeb/DemoApp/webpack.config.js\" ", "ios": "cd ios && rm -rf build && pod install && cd .. && react-native run-ios", "android": "react-native run-android --appIdSuffix demoapp --main-activity .demoapp.MainActivity && yarn run adb", "web:next": "cd reactNativeWeb && next", @@ -74,6 +75,7 @@ "babel-loader": "^9.1.3", "babel-plugin-react-native-web": "^0.18.12", "bufferutil": "^4.0.8", + "concurrently": "^9.0.1", "cors": "^2.8.5", "cross-env": "^7.0.3", "cz-conventional-changelog": "^3.3.0", diff --git a/reactNativeWeb/DemoApp/webpack.config.js b/reactNativeWeb/DemoApp/webpack.config.js new file mode 100644 index 0000000..e8890b1 --- /dev/null +++ b/reactNativeWeb/DemoApp/webpack.config.js @@ -0,0 +1,37 @@ +const path = require('path'); +const webpack = require('webpack'); +const HtmlWebpackPlugin = require('html-webpack-plugin'); +const appDirectory = path.resolve(__dirname); + +module.exports = { + entry: { + app: path.join(__dirname, 'DemoAppIndex.js'), + }, + output: { + path: path.resolve(appDirectory, 'dist'), + publicPath: '/', + filename: 'index.bundle.js', + }, + devtool: 'source-map', + devServer: { + open: true, + port: 8082, // Specify the port here + }, + resolve: { + extensions: [ + '.web.tsx', + '.web.ts', + '.tsx', + '.ts', + '.web.bs.js', + '.bs.js', + '.web.js', + '.js', + ], + }, + plugins: [ + new HtmlWebpackPlugin({ + template : path.join(__dirname, "DemoAppIndex.html") + }), + ] +};