Title: --bundle option ignores app.scss file · Issue #473 · NativeScript/nativescript-dev-webpack · GitHub
Open Graph Title: --bundle option ignores app.scss file · Issue #473 · NativeScript/nativescript-dev-webpack
X Title: --bundle option ignores app.scss file · Issue #473 · NativeScript/nativescript-dev-webpack
Description: Issue Checklist You are submitting: You verified that this is a real problem by searching the NativeScript Forum and the other issues in this repo. You checked our demo apps and the documentation for sample usage. Tell us about the probl...
Open Graph Description: Issue Checklist You are submitting: You verified that this is a real problem by searching the NativeScript Forum and the other issues in this repo. You checked our demo apps and the documentation f...
X Description: Issue Checklist You are submitting: You verified that this is a real problem by searching the NativeScript Forum and the other issues in this repo. You checked our demo apps and the documentation f...
Opengraph URL: https://github.com/NativeScript/nativescript-dev-webpack/issues/473
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"--bundle option ignores app.scss file","articleBody":"\u003c!--\r\nWe, the rest of the NativeScript community, thank you for your\r\nfeedback! \r\nTo help the rest of the community review your issue, please follow the instructions in the template.\r\n-->\r\n\r\n\u003c!-- ISSUE TEMPLATE -->\r\n\u003c!-- (Update \"[ ]\" to \"[x]\" to check a box) -->\r\n\r\n## Issue Checklist\r\n\r\n- [ ] You are submitting: \u003c!-- a feature request; a bug report. For questions, please use the [NativeScript Forum]. -->\r\n- [x] You verified that this is a real problem by searching the [NativeScript Forum] and the other [issues] in this repo.\r\n- [x] You checked our [demo apps] and the [documentation] for sample usage.\r\n\r\n## Tell us about the problem\r\n\u003c!-- Describe the issue with a few words. Provide build log and steps to reproduce if relevant. -->\r\nApplying a --bundle option makes the application lose its css. Everything is ok when the command is run without --bundle.\r\n\r\n## Local environment\r\n\r\n- [ ] Platform: Linux\r\n- [ ] Node version v6.10.2\r\n- [ ] NativeScript CLI version 3.4.3\r\n\r\n## Project data\r\n\r\n### app.component.ts\r\n```\r\n@Component({\r\n moduleId: module.id,\r\n templateUrl: './app.component.html',\r\n styleUrls: ['./app.component.scss'] // I tried to delete this line but in vain\r\n})\r\nexport class AppComponent implements OnInit, OnDestroy \r\n```\r\n### app.android.scss\r\n```\r\n@import './app-variables'; // I also tried '~/app-variables'\r\n@import '~nativescript-theme-core/scss/index';\r\n@import '~nativescript-theme-core/scss/platforms/index.android';\r\n\r\n@import './app-common';\r\n```\r\n\r\n\r\n\r\n- [x] Platform you are building the app for android\r\n- [x] Node dependencies: \r\n\r\n## package.json\r\n```\r\n\"dependencies\": {\r\n \"@angular/animations\": \"~5.2.1\",\r\n \"@angular/common\": \"^5.2.1\",\r\n \"@angular/compiler\": \"^5.2.1\",\r\n \"@angular/core\": \"^5.2.1\",\r\n \"@angular/forms\": \"^5.2.1\",\r\n \"@angular/http\": \"^5.2.1\",\r\n \"@angular/platform-browser\": \"^5.1.0\",\r\n \"@angular/platform-browser-dynamic\": \"^5.2.1\",\r\n \"@angular/router\": \"^5.2.1\",\r\n \"@ngrx/effects\": \"^4.1.1\",\r\n \"@ngrx/router-store\": \"^4.1.1\",\r\n \"@ngrx/store\": \"^4.1.1\",\r\n \"@ngrx/store-devtools\": \"^4.1.1\",\r\n \"@ngx-progressbar/core\": \"^3.0.1\",\r\n \"@ngx-progressbar/http-client\": \"^3.0.1\",\r\n \"@ngx-translate/core\": \"^6.0.1\",\r\n \"@ngx-translate/http-loader\": \"0.0.3\",\r\n \"arrive\": \"^2.3.1\",\r\n \"bootstrap\": \"4.0.0-alpha.6\",\r\n \"bootstrap-datepicker\": \"1.6.4\",\r\n \"bootstrap-social\": \"^5.1.1\",\r\n \"core-js\": \"^2.5.2\",\r\n \"font-awesome\": \"4.7.0\",\r\n \"fs\": \"0.0.1-security\",\r\n \"hammerjs\": \"^2.0.8\",\r\n \"i\": \"^0.3.6\",\r\n \"lodash\": \"^4.17.4\",\r\n \"materialize-css\": \"0.100.2\",\r\n \"nativescript-angular\": \"^5.2.0\",\r\n \"nativescript-background-http\": \"^3.2.0\",\r\n \"nativescript-bottom-navigation\": \"^1.1.2\",\r\n \"nativescript-bottombar\": \"^3.0.8\",\r\n \"nativescript-cardview\": \"^2.0.5\",\r\n \"nativescript-checkbox\": \"^3.0.3\",\r\n \"nativescript-floatingactionbutton\": \"^4.1.3\",\r\n \"nativescript-fresco\": \"^3.0.2\",\r\n \"nativescript-google-maps-sdk\": \"^2.5.0\",\r\n \"nativescript-imagepicker\": \"^5.0.0\",\r\n \"nativescript-localstorage\": \"^1.1.5\",\r\n \"nativescript-mediafilepicker\": \"^1.0.5\",\r\n \"nativescript-modal-datetimepicker\": \"^1.1.0\",\r\n \"nativescript-ng-shadow\": \"^2.1.0\",\r\n \"nativescript-oauth\": \"^2.0.1\",\r\n \"nativescript-phone\": \"^1.3.1\",\r\n \"nativescript-photoviewer\": \"^1.4.0\",\r\n \"nativescript-pro-ui\": \"^3.4.0-2018-1-9-3\",\r\n \"nativescript-snackbar\": \"^2.0.0\",\r\n \"nativescript-theme-core\": \"~1.0.2\",\r\n \"ng2-validation\": \"^4.2.0\",\r\n \"ngrx-store-freeze\": \"^0.1.9\",\r\n \"ngx-pagination\": \"^3.0.3\",\r\n \"npm\": \"^4.2.0\",\r\n \"osenv\": \"^0.1.4\",\r\n \"path\": \"^0.12.7\",\r\n \"reflect-metadata\": \"^0.1.12\",\r\n \"rxjs\": \"^5.5.5\",\r\n \"tether\": \"^1.4.3\",\r\n \"tns-core-modules\": \"^3.4.1\",\r\n \"url\": \"^0.11.0\",\r\n \"velocity-animate\": \"^1.5.1\",\r\n \"zone.js\": \"0.8.5\"\r\n },\r\n \"devDependencies\": {\r\n \"@angular/compiler-cli\": \"^5.2.1\",\r\n \"@ngtools/webpack\": \"~1.9.4\",\r\n \"@types/googlemaps\": \"^3.30.8\",\r\n \"@types/jasmine\": \"^2.8.5\",\r\n \"babel-traverse\": \"6.25.0\",\r\n \"babel-types\": \"6.25.0\",\r\n \"babylon\": \"6.17.4\",\r\n \"copy-webpack-plugin\": \"~4.3.0\",\r\n \"cross-env\": \"^5.1.3\",\r\n \"css-loader\": \"~0.28.7\",\r\n \"del\": \"^2.2.2\",\r\n \"extract-text-webpack-plugin\": \"~3.0.2\",\r\n \"gulp\": \"^4.0.0\",\r\n \"gulp-debug\": \"^3.1.0\",\r\n \"gulp-exec\": \"^3.0.1\",\r\n \"gulp-rename\": \"^1.2.2\",\r\n \"gulp-spawn\": \"^0.4.0\",\r\n \"gulp-string-replace\": \"^0.4.0\",\r\n \"lazy\": \"1.0.11\",\r\n \"mkdirp\": \"^0.5.1\",\r\n \"nativescript-css-loader\": \"~0.26.1\",\r\n \"nativescript-dev-android-snapshot\": \"^0.*.*\",\r\n \"nativescript-dev-sass\": \"^1.4.0\",\r\n \"nativescript-dev-typescript\": \"~0.6.0\",\r\n \"nativescript-dev-webpack\": \"^0.9.2\",\r\n \"nativescript-worker-loader\": \"~0.8.1\",\r\n \"raw-loader\": \"~0.5.1\",\r\n \"resolve-url-loader\": \"~2.2.1\",\r\n \"run-sequence\": \"^2.2.1\",\r\n \"sass-loader\": \"~6.0.6\",\r\n \"tns-platform-declarations\": \"^3.4.1\",\r\n \"typescript\": \"^2.4.0\",\r\n \"typescript-register\": \"^1.1.0\",\r\n \"uglifyjs-webpack-plugin\": \"~1.1.6\",\r\n \"webpack\": \"~3.10.0\",\r\n \"webpack-bundle-analyzer\": \"^2.9.1\",\r\n \"webpack-sources\": \"~1.1.0\"\r\n }\r\n```\r\n- [x] Webpack configuration:\r\n```\r\nconst { resolve, join } = require(\"path\");\r\n\r\nconst webpack = require(\"webpack\");\r\nconst nsWebpack = require(\"nativescript-dev-webpack\");\r\nconst nativescriptTarget = require(\"nativescript-dev-webpack/nativescript-target\");\r\nconst CopyWebpackPlugin = require(\"copy-webpack-plugin\");\r\nconst ExtractTextPlugin = require(\"extract-text-webpack-plugin\");\r\nconst { BundleAnalyzerPlugin } = require(\"webpack-bundle-analyzer\");\r\nconst { NativeScriptWorkerPlugin } = require(\"nativescript-worker-loader/NativeScriptWorkerPlugin\");\r\nconst UglifyJsPlugin = require(\"uglifyjs-webpack-plugin\");\r\n\r\nmodule.exports = env => {\r\n const platform = env && (env.android && \"android\" || env.ios && \"ios\");\r\n if (!platform) {\r\n throw new Error(\"You need to provide a target platform!\");\r\n }\r\n const platforms = [\"ios\", \"android\"];\r\n const { snapshot, uglify, report, aot } = env;\r\n const ngToolsWebpackOptions = { tsConfigPath: \"tsconfig.json\" };\r\n\r\n const config = {\r\n context: resolve(\"./app\"),\r\n target: nativescriptTarget,\r\n entry: {\r\n bundle: aot ? \"./main.aot.ts\" : \"./main.ts\",\r\n vendor: \"./vendor\",\r\n },\r\n output: {\r\n pathinfo: true,\r\n // Default destination inside platforms/\u003cplatform>/...\r\n path: resolve(nsWebpack.getAppPath(platform)),\r\n libraryTarget: \"commonjs2\",\r\n filename: \"[name].js\",\r\n },\r\n resolve: {\r\n extensions: [\".ts\", \".js\", \".scss\", \".css\"],\r\n // Resolve {N} system modules from tns-core-modules\r\n modules: [\r\n \"node_modules/tns-core-modules\",\r\n \"node_modules\",\r\n ],\r\n alias: {\r\n '~': resolve(\"./app\")\r\n },\r\n // don't resolve symlinks to symlinked modules\r\n symlinks: false\r\n },\r\n resolveLoader: {\r\n // don't resolve symlinks to symlinked loaders\r\n symlinks: false\r\n },\r\n node: {\r\n // Disable node shims that conflict with NativeScript\r\n \"http\": false,\r\n \"timers\": false,\r\n \"setImmediate\": false,\r\n \"fs\": \"empty\",\r\n },\r\n module: {\r\n rules: [\r\n { test: /\\.html$|\\.xml$/, use: \"raw-loader\" },\r\n\r\n // tns-core-modules reads the app.css and its imports using css-loader\r\n {\r\n test: /[\\/|\\\\]app\\.css$/,\r\n use: {\r\n loader: \"css-loader\",\r\n options: { minimize: false, url: false },\r\n }\r\n },\r\n {\r\n test: /[\\/|\\\\]app\\.scss$/,\r\n use: [\r\n { loader: \"css-loader\", options: { minimize: false, url: false } },\r\n \"sass-loader\"\r\n ]\r\n },\r\n\r\n // Angular components reference css files and their imports using raw-loader\r\n { test: /\\.css$/, exclude: /[\\/|\\\\]app\\.css$/, use: \"raw-loader\" },\r\n { test: /\\.scss$/, exclude: /[\\/|\\\\]app\\.scss$/, use: [\"raw-loader\", \"resolve-url-loader\", \"sass-loader\"] },\r\n\r\n // Compile TypeScript files with ahead-of-time compiler.\r\n { test: /.ts$/, use: [\r\n \"nativescript-dev-webpack/moduleid-compat-loader\",\r\n { loader: \"@ngtools/webpack\", options: ngToolsWebpackOptions },\r\n ]},\r\n ],\r\n },\r\n plugins: [\r\n // Vendor libs go to the vendor.js chunk\r\n new webpack.optimize.CommonsChunkPlugin({\r\n name: [\"vendor\"],\r\n }),\r\n // Define useful constants like TNS_WEBPACK\r\n new webpack.DefinePlugin({\r\n \"global.TNS_WEBPACK\": \"true\",\r\n }),\r\n // Copy assets to out dir. Add your own globs as needed.\r\n new CopyWebpackPlugin([\r\n { from: \"App_Resources/**\" },\r\n { from: \"fonts/**\" },\r\n { from: \"**/*.jpg\" },\r\n { from: \"**/*.png\" },\r\n { from: \"**/*.xml\" },\r\n ]),\r\n // Generate a bundle starter script and activate it in package.json\r\n new nsWebpack.GenerateBundleStarterPlugin([\r\n \"./vendor\",\r\n \"./bundle\",\r\n ]),\r\n // Support for web workers since v3.2\r\n new NativeScriptWorkerPlugin(),\r\n // AngularCompilerPlugin with augmented NativeScript filesystem to handle platform specific resource resolution.\r\n new nsWebpack.NativeScriptAngularCompilerPlugin(\r\n Object.assign({\r\n entryModule: resolve(__dirname, \"app/native.module#AppModule\"),\r\n skipCodeGeneration: !aot,\r\n platformOptions: {\r\n platform,\r\n platforms,\r\n // ignore: [\"App_Resources\"]\r\n },\r\n }, ngToolsWebpackOptions)\r\n ),\r\n // Does IPC communication with the {N} CLI to notify events when running in watch mode.\r\n new nsWebpack.WatchStateLoggerPlugin(),\r\n ],\r\n };\r\n if (report) {\r\n // Generate report files for bundles content\r\n config.plugins.push(new BundleAnalyzerPlugin({\r\n analyzerMode: \"static\",\r\n openAnalyzer: false,\r\n generateStatsFile: true,\r\n reportFilename: join(__dirname, \"report\", `report.html`),\r\n statsFilename: join(__dirname, \"report\", `stats.json`),\r\n }));\r\n }\r\n if (snapshot) {\r\n config.plugins.push(new nsWebpack.NativeScriptSnapshotPlugin({\r\n chunk: \"vendor\",\r\n projectRoot: __dirname,\r\n webpackConfig: config,\r\n targetArchs: [\"arm\", \"arm64\", \"ia32\"],\r\n tnsJavaClassesOptions: { packages: [\"tns-core-modules\" ] },\r\n useLibs: false\r\n }));\r\n }\r\n if (uglify) {\r\n config.plugins.push(new webpack.LoaderOptionsPlugin({ minimize: true }));\r\n\r\n // Work around an Android issue by setting compress = false\r\n const compress = platform !== \"android\";\r\n config.plugins.push(new UglifyJsPlugin({\r\n uglifyOptions: {\r\n mangle: { reserved: nsWebpack.uglifyMangleExcludes },\r\n compress,\r\n }\r\n }));\r\n }\r\n return config;\r\n};\r\n```\r\n\r\nCommand executed : tns run android --bundle --device avd27\r\n\r\n[NativeScript Forum]: http://forum.nativescript.org\r\n[issues]: https://github.com/nativescript/nativescript-dev-webpack/issues?utf8=✓&q=is%3Aissue\r\n[demo apps]: ../demo\r\n[documentation]: https://docs.nativescript.org/best-practices/bundling-with-webpack\r\n","author":{"url":"https://github.com/RadouaneRoufid","@type":"Person","name":"RadouaneRoufid"},"datePublished":"2018-03-23T10:13:26Z","url":"https://github.com/NativeScript/nativescript-dev-webpack/issues/473"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3df62e8f-5c8e-b334-83a8-d9ae24f382d5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C43C:269AD9:1B4B356:246D096:6B015D81 |
| html-safe-nonce | 93f760508211080b9cc37c2796ce7268168764711b282dd58a528ca35c970b23 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNDNDOjI2OUFEOToxQjRCMzU2OjI0NkQwOTY6NkIwMTVEODEiLCJ2aXNpdG9yX2lkIjoiODc2NDkzOTY5Nzc2NTA0NzY4MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 9e4a79106117a9f2015593b107a2e095a12f756f545726f643db295082238c79 |
| hovercard-subject-tag | issue:307970003 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/NativeScript/nativescript-dev-webpack/473/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cbc5a188cf062aa8e851767a6f55bf6f22e82a8d07862fcca3f250f6dd246c66/NativeScript/nativescript-dev-webpack/issues/473 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cbc5a188cf062aa8e851767a6f55bf6f22e82a8d07862fcca3f250f6dd246c66/NativeScript/nativescript-dev-webpack/issues/473 |
| og:image:alt | Issue Checklist You are submitting: You verified that this is a real problem by searching the NativeScript Forum and the other issues in this repo. You checked our demo apps and the documentation f... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | RadouaneRoufid |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/NativeScript/nativescript-dev-webpack git https://github.com/NativeScript/nativescript-dev-webpack.git |
| octolytics-dimension-user_id | 7392261 |
| octolytics-dimension-user_login | NativeScript |
| octolytics-dimension-repository_id | 54984270 |
| octolytics-dimension-repository_nwo | NativeScript/nativescript-dev-webpack |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 54984270 |
| octolytics-dimension-repository_network_root_nwo | NativeScript/nativescript-dev-webpack |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width