Closed EyMaddis closed 1 year ago
@pavjacko
So I hackily replace the webpack path with doResolve('webpack')
, now it builds, but the for -p tizen
it builds the appShell, not the real app.
The platformBuilds/blank_tizen/project/build
directory does not contain any .js files, just the appShell.
However, platformBuilds/blank_tizen/server/
contains everything html/js related, but not the config.xml and other tizen specific files.
@EyMaddis that's correct behavior. In order to provide hot reloads for tizen the appShell is being installed on the device/emu. It's nothing more than a small little website which redirects to the webpack's url upon launch. Webpack should build your app and serve it with webpack-dev-server, rnv will inject the url into appShell and install it on the TV. After 5s of launching the appShell you should see your app.
@mihaiblaga89 For development yes but I meant release builds. Tizen does not support export
or deploy
, so I assume that rnv build -p tizen
should build a production release bundle.
I also tried setting the env NODE_ENV=production
.
Am I missing something? I cannot find anything else in the documentation to create a release .wgt file.
EDIT: I found it after digging through the code:
rnv build -p tizen -s release
with renative.json:
"tizen": {
"buildSchemes": {
"debug": {
"bundleAssets": false
},
"release": {
"bundleAssets": true
}
}
},
@EyMaddis where did you add doResolve('webpack')
I'm having the same issue when using the local rnv
package yarn rnv build -p ...
instead of global:
Error: Cannot find module '......./node_modules/rnv/node_modules/webpack/bin/webpack.js'
@alaingoga Of the top of my head it was the sdk-webpack.js file and I just changed it manually for the build, if I remember correctly
Thanks @EyMaddis I found where webpack is called: https://github.com/pavjacko/renative/blob/release/0.31/packages/rnv/src/sdk-webpack/index.js#L258
Also why it works for rnv run
and its because there is an alternative here: https://github.com/pavjacko/renative/blob/release/0.31/packages/rnv/src/sdk-webpack/index.js#L485
Root cause of the problem is that in local RNV_NODE_MODULES_DIR is pointing to /node_modules/rnv/node_modules/
instead of where the app is and is living so /node_modules/webpack/bin/webpack.js
. Can be resolved.
https://github.com/pavjacko/renative/blob/release/0.31/packages/rnv/src/core/constants.js#L8
I wonder why?
By changing:
export const RNV_NODE_MODULES_DIR = path.join(RNV_HOME_DIR, 'node_modules');
to
export const RNV_NODE_MODULES_DIR = path.join(RNV_HOME_DIR, '../../node_modules');
it works.
But i guess this may break global rnv
use.
The proper way would be to use something like require.resolve()
, but I think I tried it and it does not result in the same file that rnv uses right now.
@pavjacko
I think this works:
const WEBPACK = require.resolve('webpack-cli/bin/cli.js');
However, maybe this is only for me...? I wonder why you use webpack
and not webpack-cli
...?
I am guessing the same can be done with webpack-dev-server
@EyMaddis @pavjacko
The same happens with NPM, I ran rnv build -p tizen
and it throws this:
npx cross-env PLATFORM=tizen NODE_ENV=production node /home/vl/Documents/study/test/node_modules/rnv/node_modules/webpack/bin/webpack.js -p --config ./platformBuilds/helloworld_tizen/webpack.config.prod.js
FAILED with ERROR:
Error: Cannot find module '/home/vl/Documents/study/test/node_modules/rnv/node_modules/webpack/bin/webpack.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
Command failed with exit code 1 (EPERM): npx cross-env PLATFORM=tizen NODE_ENV=production node /home/vl/Documents/study/test/node_modules/rnv/node_modules/webpack/bin/webpack.js -p --config ./platformBuilds/helloworld_tizen/webpack.config.prod.js
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module '/home/vl/Documents/study/test/node_modules/rnv/node_modules/webpack/bin/webpack.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
Error: Command failed with exit code 1 (EPERM): npx cross-env PLATFORM=tizen NODE_ENV=production node /home/vl/Documents/study/test/node_modules/rnv/node_modules/webpack/bin/webpack.js -p --config ./platformBuilds/helloworld_tizen/webpack.config.prod.js
at makeError (/home/vl/Documents/study/test/node_modules/rnv/node_modules/execa/lib/error.js:58:11)
at handlePromise (/home/vl/Documents/study/test/node_modules/rnv/node_modules/execa/index.js:112:26)
at process._tickCallback (internal/process/next_tick.js:68:7)
This is freshly fetched unchanged project. Running on:
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
Node: 10.19.0
NPM: 6.14.4
I have tried suggestions from above and nothing works, how does one simply builds a project for Tizen, thanks
@VladLegkowski make sure you edited the correct file, there are 2 spots where the webpack path is defined. Once for dev and once for production builds. Search for bin/webpack.js
and change it to something that definitely breaks like /TEST/
to see if it lands in the output, if not: keep searching or you are not in the correct rnv folder.
@EyMaddis, can you tell me what do you refer to exactly - I see there are few different propositions to fix the issue in this thread.
Sorry, again, but is there a working branch or can someone who manages to make it work create a step by step? I know ifs a big ask but this would help I am sure to the project.
@VladLegkowski this works for me: https://github.com/simpleTechs/renative/tree/simpleTechs That is the change: https://github.com/simpleTechs/renative/commit/8a9446d15f8585d4e251fcfc22177ff4fcf089eb#diff-2fe34df7a4d5ff39cd67b3c6b5c06a43c88aa0dafb62c1803f99d1612c68ac7cL56
@EyMaddis, sorry for the late reply, this worked. Thank you.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@EyMaddis thanks for reporting this issue, is this still reproduced on latest rnv version?
@EyMaddis closing this, feel free to reopen if needed
Describe the bug The same problem described in https://github.com/pavjacko/renative/issues/585 is still a problem when building via
rnv build
This time it is
webpack
itself.Expected behavior App should build.
Screenshots or copy&paste
Desktop (please complete the following information):
Additional context Renative Project is within a subdirectory of another yarn project.