NativeScript / NativeScript/nativescript-cli

[android] packaged aar should be by modules appearing after webpack compilation

未关闭
#4,400 2 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

@KristianDD 已经在做这个了。

开始于 2019年2月27日。

feature plugins
主要语言
JavaScript
星标
1.1k
派生
204
平均合并
1 天 9 小时
30 天内合并 PR
8

描述

I now use webpack-strip-block in my app to remove code in production.
The idea behind this is to be able to use nativescript-vue-devtools in dev but obviously remove it in production.
So i add this to my webpack

if (!!production) {
        config.module.rules.push({
            test: /\.tsx?$/,
            enforce: 'pre',
            exclude: /node_modules/,
            use: [
                {
                    loader: 'webpack-strip-block',
                    options: {
                        start: 'DEV-START',
                        end: 'DEV-END'
                    }
                }
            ]
        });
    }

and in my app i do something like this:

/* DEV-START */
console.log('only shown in dev', device.model, device.os, device.osVersion, device.manufacturer);
const VueDevtools = require('nativescript-vue-devtools');
Vue.use(VueDevtools);
/* DEV-END */

This works perfectly and the code is removed in prod. So nativescript-dev-tools is not packd in prod.
But remains the issue of the native version of the modules. nativescript-dev-tools depends on nativescript-socket-io which has native lib.
My issue is that nativescript-socket-io native lib will always be packed with my app even if ``nativescript-dev-toolsis stripped and thennativescript-socket-io``` not packaged.

The list of native module to be added by filtering used packages after webpack compilation (not sure how that list is created right now). It should not be based on the package.json

Hope that issue makes sense

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。