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

Incompatible with scoped packages #1089

Closed
1 task
PeterStaev opened this issue Nov 6, 2019 · 3 comments
Closed
1 task

Incompatible with scoped packages #1089

PeterStaev opened this issue Nov 6, 2019 · 3 comments
Assignees
Labels
Milestone

Comments

@PeterStaev
Copy link
Contributor

PeterStaev commented Nov 6, 2019

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 6.2

  • Cross-platform modules:6.2

  • Android Runtime:6.2

  • iOS Runtime:6.2

  • Plugin(s):

  • Node.js:

  • Please, attach your package.json and webpack.config.js as these configurations are usually critical for investigating issues with webpack

Describe the bug
The plugin and config files are totally incompatible with the new scoped packages.

To Reproduce

tns create test --tsc
npm remove tns-core-modules
npm install @nativescript/core

Replace all reference to tns-core-modules with @nativescript/core and trying to build fails with a nice fat webpack error.
Even if you replace all reference to tns-core-modules in the webpack.config.js it still doesnt work.

Using 1 worker with 4096MB memory limit

webpack is watching the files…


Insufficient number of arguments or no entry found.
Alternatively, run 'webpack(-cli) --help' for usage info.

Hash: 58df9609a1250bc5ac5c
Version: webpack 4.27.1
Time: 2502ms
Built at: 11/07/2019 12:22:48 AM
 3 assets
Entrypoint bundle = runtime.js vendor.js bundle.js
[./ sync ^\.\/app\.(css|scss|less|sass)$] . sync nonrecursive ^\.\/app\.(css|scss|less|sass)$ 174 bytes {bundle} [built]
[./ sync recursive (?<!\bApp_Resources\b.*)(?<!\.\/\btests\b\/.*?)\.(xml|css|js|(?<!\.d\.)ts|(?<!\b_[\w-]*\.)scss)$] . sync (?<!\bApp_Resources\b.*)(?<!\.\/\btests\b\/.*?)\.(xml|css|js|(?<!\.d\.)ts|(?<!\b_[\w-]*\.)scss)$ 270 bytes {bundle} [built]
[./app-root.xml] 309 bytes {bundle} [optional] [built]
[./app.css] 4.59 KiB {bundle} [not cacheable] [optional] [built] [failed] [1 error]
[./app.ts] 1.97 KiB {bundle} [built]
[./main-page.ts] 1.35 KiB {bundle} [optional] [built]
[./main-page.xml] 1.87 KiB {bundle} [optional] [built]
[./main-view-model.ts] 1.46 KiB {bundle} [built]
[./package.json] 99 bytes {bundle} [optional] [built]
    + 118 hidden modules

WARNING in ./app.css
Module build failed (from ../node_modules/nativescript-dev-webpack/css2json-loader.js):
Error: Cannot find module 'tns-core-modules/css'
Require stack:
- /Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/nativescript-dev-webpack/css2json-loader.js
- /Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/loader-runner/lib/loadLoader.js
- /Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/loader-runner/lib/LoaderRunner.js
- /Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/webpack/lib/NormalModule.js
- /Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/webpack/lib/NormalModuleFactory.js
- /Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/webpack/lib/Compiler.js
- /Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/webpack/lib/webpack.js
- /Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/webpack-cli/bin/convert-argv.js
- /Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/webpack-cli/bin/cli.js
- /Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/webpack/bin/webpack.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
    at Function.Module._load (internal/modules/cjs/loader.js:687:27)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (/Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at Object.<anonymous> (/Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/nativescript-dev-webpack/css2json-loader.js:3:15)
    at Module._compile (/Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/v8-compile-cache/v8-compile-cache.js:194:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (/Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at loadLoader (/Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/loader-runner/lib/loadLoader.js:18:17)
    at iteratePitchingLoaders (/Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at iteratePitchingLoaders (/Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/loader-runner/lib/LoaderRunner.js:165:10)
    at /Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/loader-runner/lib/LoaderRunner.js:176:18
    at loadLoader (/Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/loader-runner/lib/loadLoader.js:47:3)
    at iteratePitchingLoaders (/Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at runLoaders (/Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/loader-runner/lib/LoaderRunner.js:365:2)
    at NormalModule.doBuild (/Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/webpack/lib/NormalModule.js:280:3)
    at NormalModule.build (/Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/webpack/lib/NormalModule.js:427:15)
    at Compilation.buildModule (/Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/webpack/lib/Compilation.js:633:10)
    at /Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/webpack/lib/Compilation.js:882:14
    at /Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/webpack/lib/NormalModuleFactory.js:405:6
    at /Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/webpack/lib/NormalModuleFactory.js:155:13
    at AsyncSeriesWaterfallHook.eval [as callAsync] (eval at create (/Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at /Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/webpack/lib/NormalModuleFactory.js:138:29
    at /Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/webpack/lib/NormalModuleFactory.js:342:9
    at processTicksAndRejections (internal/process/task_queues.js:75:11)
 @ \b_[\w-]*\.)scss)$ (. sync (?<!\bApp_Resources\b.*)(?<!\.\/\btests\b\/.*?)\.(xml|css|js|(?<!\.d\.)ts|(?<!\b_[\w-]*\.)scss)$) ./app.css
 @ ./app.ts

ERROR in Entry module not found: Error: Can't resolve 'inspector_modules' in '/Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/app'

ERROR in ../node_modules/nativescript-dev-webpack/load-application-css.js
Module not found: Error: Can't resolve 'tns-core-modules/application' in '/Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/nativescript-dev-webpack'
 @ ../node_modules/nativescript-dev-webpack/load-application-css.js 2:24-63
 @ ../node_modules/nativescript-dev-webpack/load-application-css-regular.js
 @ ./app.ts

ERROR in ./app.ts
Module not found: Error: Can't resolve 'tns-core-modules/bundle-entry-points' in '/Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/app'
 @ ./app.ts 37:8-55

ERROR in ../node_modules/nativescript-dev-webpack/hmr/hmr-update.js
Module not found: Error: Can't resolve 'tns-core-modules/file-system' in '/Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/nativescript-dev-webpack/hmr'
 @ ../node_modules/nativescript-dev-webpack/hmr/hmr-update.js 4:22-61
 @ ../node_modules/nativescript-dev-webpack/hmr/index.js
 @ ./app.ts

ERROR in ../node_modules/nativescript-dev-webpack/load-application-css.js
Module not found: Error: Can't resolve 'tns-core-modules/ui/styling/style-scope' in '/Users/peter/Documents/NativeScriptProjects/_issues/webpack-test/node_modules/nativescript-dev-webpack'
 @ ../node_modules/nativescript-dev-webpack/load-application-css.js 3:4-54
 @ ../node_modules/nativescript-dev-webpack/load-application-css-regular.js
 @ ./app.ts

Expected behavior

  • webpack.config.js should be update to support scope package usage.
  • plugin should be updated to support scope package usage.

Sample project

Additional context

@rosen-vladimirov
Copy link
Contributor

Hey @PeterStaev ,
Thanks for reporting this. Indeed you are correct, we need to apply some changes in nativescript-dev-webpack, which will allow using only scoped packages in the project. We are in the process of handling this case and we'll try to include this feature in our next minor release.

@dtopuzov
Copy link
Contributor

The state:

  • For NG projects it will work out of the box even with old references in app
  • For TS projects it will work only if all references inside app are with @nativescript/core

@dtopuzov
Copy link
Contributor

dtopuzov commented Jan 7, 2020

Closing since the original issue is resolved.

@dtopuzov dtopuzov closed this as completed Jan 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants