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

chore: build/transpile itowns to specific targets. #1231

Closed
wants to merge 2 commits into from
Closed
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
6 changes: 5 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"presets": ["@babel/preset-env"],
"presets": [["@babel/preset-env",
{
"targets": "> 0.5%, last 2 versions, Firefox ESR, not dead"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This query (which is equivalent to "defaults") includes Opera Mini which, among others things, doesn't support WebGL.

}
]],
"plugins": [
["module-resolver", { "root": ["./src"] } ],
["babel-plugin-inline-import", {
Expand Down
19 changes: 10 additions & 9 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@ const debugBuild = process.env.NODE_ENV === 'development';
// Note that we don't support .babelrc in parent folders
var babelrc = fs.readFileSync(path.resolve(__dirname, '.babelrc'));
var babelConf = JSON.parse(babelrc);
var newPresets = [];
for (var preset of babelConf.presets) {
if (!Array.isArray(preset)) {
preset = [preset];
}
preset.push({ modules: false });
newPresets.push(preset);
}
// TODO verify utility
// var newPresets = [];
// for (var preset of babelConf.presets) {
// if (!Array.isArray(preset)) {
// preset = [preset];
// }
// preset.push({ modules: false });
// newPresets.push(preset);
// }

babelConf.presets = newPresets;
// babelConf.presets = newPresets;
babelConf.babelrc = false; // disabel babelrc reading, as we've just done it
const replacementPluginConf = babelConf.plugins.find(plugin => Array.isArray(plugin) && plugin[0] === 'minify-replace');
replacementPluginConf[1].replacements.find(decl => decl.identifierName === '__DEBUG__').replacement.value = debugBuild;
Expand Down