小编JGo*_*ive的帖子

如何处理javascript包中的版权声明?

我正在编写几个小演示来向同事解释装饰器(在打字稿中),当我注意到我的捆绑包有一个 Microsoft 版权声明,这种通知使我的整个文件对所有人免费(并且由 MS 制作)。

这应该如何有效处理(如果我创建了一些不是免费的东西)?

我使用 Typescript 3.1 进行编译和汇总以进行捆绑。

代码:

import { isNotUndefined, isNotNullOrUndefined } from "goodcore/Test";

function deprecated<S>(instead?: string, message?: string) {
    // Logic removed for brevity...
}

class Car {
    @deprecated()
    public turnIgnitionKey() {
        this.start();
    }
    public pressStartButton() {
        this.start();
    }
    private start() {
        console.log("Running!");
    }
}

let car = new Car();
car.turnIgnitionKey();
car.pressStartButton();
Run Code Online (Sandbox Code Playgroud)

和 bundle 开始(最后一个函数是我的,之前的那些是 MS):

'use strict';

/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the …
Run Code Online (Sandbox Code Playgroud)

bundling-and-minification typescript copyright-display rollupjs

6
推荐指数
2
解决办法
1906
查看次数

asp.net 4.5脚本捆绑也没有bundeling也没有缩小

我将一个项目从asp.net 3.5升级到4.5,以便使用脚本捆绑和javascript的缩小.现在我把它全部运行了,脚本都出现在我定义的包中但是它们没有在一个脚本中"捆绑"在一起而且它们没有缩小.

继承人我拥有的......

default.aspx包含:

<asp:ScriptManager
ID="scriptmanager"
LoadScriptsBeforeUI="false"
runat="server"
    ScriptMode="Release"
    EnableScriptLocalization="false"
>
    <Scripts>
        <%--Framework Scripts--%>
        <asp:ScriptReference Path="~/bundles/MyBundle" ScriptMode="Release"/>
        <%--Site Scripts--%>
    </Scripts>
</asp:ScriptManager>
Run Code Online (Sandbox Code Playgroud)

Global.asax中的Application_Start:

BundleTable.EnableOptimizations = true;
BundleConfig.RegisterBundles(BundleTable.Bundles);
Run Code Online (Sandbox Code Playgroud)

BundleConfig.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Optimization;

namespace MyNameSpace
{
    public class BundleConfig
    {
        // For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254726
        public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/bundles/MyBundle").Include(
                "~/Scripts/WebForms/WebForms.js",
                "~/Scripts/WebForms/MSAjax/MicrosoftAjax.js",
                "~/Scripts/WebForms/MSAjax/MicrosoftAjaxWebForms.js",
                "~/Scripts/WebForms/TreeView.js",
                "~/Scripts/WebForms/Focus.js",
                "~/Scripts/WebForms/MenuStandards.js"));

        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我甚至在web.config中关闭了调试,即使我尝试在scriptmanager中强制释放模式以及脚本引用.

<compilation debug="false" batch="true" targetFramework="4.5">
Run Code Online (Sandbox Code Playgroud)

输出仍然是几个引用:

<script src="/MyProj/WebResource.axd?d=pynGkmcFUV13He1Qd6_TZA6EiyQ1YRW47qIzscWLzWU7jP_7DjoC2XbU7kCBkgYcJdoeAwqaVpUMnbWRsvhdMw2&amp;t=634896541540000000" type="text/javascript"></script>
<script src="/MyProj/ScriptResource.axd?d=zvkqIRNUspAvS1yKeFhMb4kS_IY-Q_9Yn_KOfmzKLnliETz8uip5T2BUr1JOPE4XV1bmnifY3Eg8vrX8bPLYT71P0Kf8DwEcoRw5fj2tqHdQSorRXVpasfsMXeJLHbT_alkHjf2wIrgxLzxYvocKIA2&amp;t=12e197aa" …
Run Code Online (Sandbox Code Playgroud)

asp.net scriptmanager bundling-and-minification

5
推荐指数
1
解决办法
3704
查看次数

babel 7 在使用 typescript 插件进行汇总时不会进行转译

我似乎无法让 rollup-plugin-babel 在我的打字稿项目中工作。.ts 代码编译并汇总包,生成映射文件,但 babel 不会转译它。

另外,如果我运行npx babel lab.js --out-file lab-es5.jsbabel 似乎工作得很好。

这是我的 rollup.config.js

import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';
import typescript from 'rollup-plugin-typescript2'
import sourcemaps from 'rollup-plugin-sourcemaps';
import babel from 'rollup-plugin-babel';

var plugins = [
    nodeResolve({
        module: true,
        jsnext: true,
        main: true,
        preferBuiltins: false
    }),
    commonjs({
        include: 'node_modules/**',  // Default: undefined
        ignoreGlobal: false,  // Default: false
    }),
    typescript(/*{ plugin options }*/),
    babel({
        exclude: 'node_modules/**',
        runtimeHelpers: true
    }),
    sourcemaps()
];

export default [
    {
        input: 'src/lab.ts', …
Run Code Online (Sandbox Code Playgroud)

rollup typescript babeljs

5
推荐指数
1
解决办法
5533
查看次数