Open jakearchibald opened 4 years ago
Rollup solution, which uses a /*#__PURE__*/
hint.
I make use of these pureness hints in rollup-plugin-assemblyscript to supply conveniences exports that can get tree-shookanized when unused:
const wasmUrl = /* injected by Rollup */;
const modulePromise = /*@__PURE__*/compileStreaming(fetch(wasmUrl));
const instancePromise = /*@__PURE__*/modulePromise.then(module => WebAssembly.instantiate(module, {}));
export {wasmUrl, modulePromise, instancePromise};
So I agree, this should be a subtest for treeshaking.
I am doing this.
This would be a tree-shaking test.
Something like:
main.js
lib.js
Where the output wouldn't contain foo. The solution may require a pureness hint. WDYT @surma?