-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pure annotations house cleaning: Webpack #24336
Pure annotations house cleaning: Webpack #24336
Conversation
@@ -7,7 +7,7 @@ import { AnimationClip } from './AnimationClip.js'; | |||
import { NormalAnimationBlendMode } from '../constants.js'; | |||
|
|||
|
|||
const _controlInterpolantsResultBuffer = /*@__PURE__*/ new Float32Array( 1 ); | |||
const _controlInterpolantsResultBuffer = new Float32Array( 1 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pure annotation isn't needed.
exponentTable: _exponentTable, | ||
offsetTable: _offsetTable | ||
} = /*@__PURE__*/ _generateTables(); | ||
const _tables = /*@__PURE__*/ _generateTables(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Object destructuring assignment with a pure annotation doesn't work in webpack/terser.
FWIW here's my webpack configuration I've been using for troubleshooting tree-shaking, I like having the output as human readable as possible, and process of elimination from bottom to top. 😅 mkdir test
cd test
npm init -y
npm i three webpack webpack-cli webpack.config.js const TerserPlugin = require('terser-webpack-plugin');
const path = require('path');
module.exports = {
entry: './src/index.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
},
experiments: {
outputModule: true,
},
optimization: {
usedExports: true,
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
compress: {
defaults: false,
unused: true,
},
mangle: false,
format: {
comments: true,
beautify: true,
},
},
extractComments: false,
}),
],
},
mode: 'production',
}; src/index.js import { Vector2 } from 'three';
console.log(new Vector2(0, 1)); npx webpack |
Thanks! |
Related issue: #24199
Troubleshooting the remaining side-effects in
r142
, I've gone through all the/*@__PURE__*/
annotations again with webpack this time.