Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

upgrading to 0.12 breaks older projects with nativescript-ui-sidedrawer #555

Closed
pbgc opened this issue Jun 5, 2018 · 2 comments
Closed

Comments

@pbgc
Copy link

pbgc commented Jun 5, 2018

Following the instructions to upgrade an older (pre - 4.0 that was working perfectly on 4.0 and 4.1, with webpack 3) to 0.12 (https://www.nativescript.org/blog/upgrading-to-nativescript-webpack-0.12.0) and deleting bundle-config.js breaks the sidedrawer.

To get it woking I need to import a bundle-config.js with at least these lines:

if (global.TNS_WEBPACK) {
// This will register each page postfixed xml, css, js, ts, scss etc. in the app/ folder
context = require.context("~/", true, /(page|fragment).(xml|css|js|ts|scss|less|sass)$/);
global.registerWebpackModules(context);
}

because older projects (created by Sidekick!) use:

app/shared/drawer-fragment.xml
app/shared/drawer-fragment.android.xml
....

and it seems that only content with suffix '-page' is processed by the new webpack.config and not the ones with '-fragment' like before using the bundle-config.js

@NickIliev
Copy link
Contributor

@pbgc indeed this might happen as there are some changes in [email protected].

Bundle config loader
The bundle-config-loader is applied to the entry module and its job is to insert a few predefined configurations. It has the following options:

registerPages <boolean>

Default: true

Registers your app’s XML, CSS and JavaScript pages with a regex. All your pages' resources should be named so that they end with either root or page. For example - main-page.xml, main-page.css, main-page.js.

Migration guide here

@pbgc
Copy link
Author

pbgc commented Jun 7, 2018

@NickIliev
OK. I found a workaround (use the bundle-config.js just to register the pages with -fragment suffix) and my project is working .... but I really think that you are wrong! .... when in a Migration guide say to just delete the bundle-config.js file .... and just break projects CREATED WITH SIDEKICK and that were working perfectly with Nativescript 4.1 ....
It would be a LOT nicer to give some direct advice! (IF you are using a project created by sidekick and using the Drawer Template that still uses the shared / fragment aproach .... you must to this and this ... or your project will break if you use webpack bundle ....)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants