opened
sean-perkins
username_0
### Did you verify this is a real problem by searching [Stack Overflow]
Yes

### Tell us about the problem
After a patch in `tns-core-modules`, webpack will fail to build. 

### Which platform(s) does your issue occur on?
iOS - most likely both

### Please provide the following version numbers that your issue occurs with:
- CLI: 3.1.2
- Cross-platform modules: 3.1.1
- Runtime(s): 3.1.0

### Please tell us how to recreate the issue in as much detail as possible.
1. Use the latest tns-core-modules
2. Build with webpack
3. See the following warning on build
```
WARNING in ../~/tns-core-modules/profiling/profiling.js
Module not found: Error: Can't resolve '~/package.json' in '/Users/seanperkins/Documents/Projects/loop/nativescript/node_modules/tns-core-modules/profiling'
 @ ../~/tns-core-modules/profiling/profiling.js 102:20-45
 @ ../~/nativescript-angular/platform-common.js
 @ ../~/nativescript-angular/platform-static.js
 @ ./vendor.ts

```
4. Webpack build fails

### Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.

Reverting the code in `profile.js` from this commit:

https://github.com/NativeScript/NativeScript/commit/b1432679e68eed39b155f1d3ab335a56abda0010#diff-a1e9fef8fce4d5cedbe9625acd2c9d8c

to:
https://github.com/NativeScript/NativeScript/blob/08b16b3b5aec09331309c66a168071dcca3657d0/tns-core-modules/profiling/profiling.ts#L122

Resolves the issues. Webpack cannot understand the require statement, unless accessed from the global namespace. 

Also downgrading to 3.1.0 for `tns-core-modules` resolves the issue.
tns-core-modules 3.1.1 patch breaks webpack builds
issue
created
sis0k0
username_1
Please, add this alias to your webpack configuration:
https://github.com/NativeScript/nativescript-dev-webpack/blob/e4148bb57feca221fb49a15447ea52e52041d02f/templates/webpack.angular.js#L54-L56
comment
created
sis0k0
username_1
Also, as you mentioned this is a warning. The build must be failing for another reason.
comment
created
sean-perkins
username_0
@username_1 Brilliant, that does resolve the build conflict, thanks! Unfortunately replacing that one line as mentioned, causes the build to pass or fail; so it does seem attributed to that change.
comment
closed
sean-perkins
username_0
issue