Skip to content

about tree-shaking #4488

@wdssmq

Description

@wdssmq
// base.js
const str1 = "1111";

const str2 = "2222".trim();

const str3 = `3333`;

const str4 = `4444`.trim();

const $ = window.$ || unsafeWindow.$;

export { str1, str2, str3, str4, $ };
// main.js
import { str1, str2, str3, str4, $ } from "./base";

console.log(str1);

bundle:

(function () {
	'use strict';

	// base.js
	const str1 = "1111";

`4444`	.trim();

	window.$ || unsafeWindow.$;

	// main.js

	console.log(str1);

})();

如何不输出「4444 .trim();」和 window.$ || unsafeWindow.$;两行?

How to not output 「4444 .trim();」and window.$ || unsafeWindow.$;?

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