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

Webpack looses styles when uglified #24

@ignaciolarranaga

Description

@ignaciolarranaga

Steps to reproduce

  • tns create Sample --ng
  • Now add for example yellow background to the sample StackLayout
    app.component.ts:
...
@Component({
    selector: "my-app",
    templateUrl: "app.component.html",
    styleUrls: [ "app.component.css" ]
})
...

app.component.css:

StackLayout {
    background-color: yellow;
}
  • tns install webpack
  • tns prepare ios --emulator --bundle
  • tns run ios --emulator --bundle

Till there all looks correct:
simulator screen shot nov 12 2016 06 49 46

Now add the uglification:

  • npm install webpack --save-dev
  • tns prepare ios --emulator --bundle
  • tns run ios --emulator --bundle
  • Adjust the webpack config:
    webpack.config.js:
var bundler = require("nativescript-dev-webpack");
var webpack = require("webpack");

module.exports = bundler.getConfig({
    plugins: [
        new webpack.optimize.UglifyJsPlugin({
            comments: false,
            compress: { warnings: false }
        })
    ]
});

And there is where the error occurs:
simulator screen shot nov 12 2016 06 55 22

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions