Skip to content
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

Remove debug code from transpiled sources. #531

Merged
merged 2 commits into from
Oct 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
"presets": ["es2015"],
"plugins": [
"transform-runtime",
[ "babel-plugin-webpack-loaders", { "config": "./webpack-babel.config.js", "verbose": false }]
[ "babel-plugin-webpack-loaders", { "config": "./webpack-babel.config.js", "verbose": false }],
["minify-replace", {
"replacements": [{
"identifierName": "__DEBUG__",
"replacement": {
"type": "booleanLiteral",
"value": false
}
}]
}],
["minify-dead-code-elimination"]
]
}
42 changes: 42 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
"babel-cli": "^6.22.2",
"babel-core": "^6.22.1",
"babel-loader": "^7.0.0",
"babel-plugin-minify-dead-code-elimination": "^0.2.0",
"babel-plugin-minify-replace": "^0.2.0",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-plugin-webpack-loaders": "^0.9.0",
"babel-preset-es2015": "^6.22.2",
Expand Down
19 changes: 4 additions & 15 deletions webpack-babel.config.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,16 @@
var path = require('path');

var commonConfig = require('./webpack-common.config.js');

module.exports = {
output: {
libraryTarget: 'commonjs2',
umdNamedDefine: true,
},
module: {
rules: [
// please consider modifying corresponding loaders in webpack.config.js too
{
test: /\.glsl$/,
include: [
path.resolve(__dirname, 'src'),
],
loader: 'raw-loader',
},
{
test: /\.json$/,
include: [
path.resolve(__dirname, 'utils'),
],
loader: 'raw-loader',
},
commonConfig.glslLoader,
commonConfig.jsonLoader,
],
},
};
21 changes: 21 additions & 0 deletions webpack-common.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
var path = require('path');

module.exports = {
glslLoader: {
// please consider modifying corresponding loaders in webpack-babel.config.js too
test: /\.glsl$/,
include: [
path.resolve(__dirname, 'src'),
path.resolve(__dirname, 'test'),
],
loader: 'raw-loader',
},
jsonLoader: {
// please consider modifying corresponding loaders in webpack-babel.config.js too
test: /\.json$/,
include: [
path.resolve(__dirname, 'utils'),
],
loader: 'raw-loader',
},
};
21 changes: 4 additions & 17 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
var path = require('path');
var webpack = require('webpack');

var commonConfig = require('./webpack-common.config.js');

var definePlugin = new webpack.DefinePlugin({
__DEBUG__: JSON.stringify(process.env.NODE_ENV === 'development'),
});
Expand Down Expand Up @@ -57,23 +59,8 @@ module.exports = {
babelrc: false,
},
},
{
// please consider modifying corresponding loaders in webpack-babel.config.js too
test: /\.glsl$/,
include: [
path.resolve(__dirname, 'src'),
path.resolve(__dirname, 'test'),
],
loader: 'raw-loader',
},
{
// please consider modifying corresponding loaders in webpack-babel.config.js too
test: /\.json$/,
include: [
path.resolve(__dirname, 'utils'),
],
loader: 'raw-loader',
},
commonConfig.glslLoader,
commonConfig.jsonLoader,
],
},
devServer: {
Expand Down