Skip to content

Commit

Permalink
Configure embroider to be on by default
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Jun 6, 2020
1 parent fb0d573 commit 4a64bf0
Show file tree
Hide file tree
Showing 3 changed files with 370 additions and 227 deletions.
2 changes: 1 addition & 1 deletion client/web/emberclear/config/build/babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
return {
// was for enabling dynamic import.
babel: {
plugins: [require.resolve('ember-auto-import/babel-plugin')],
// plugins: [require.resolve('ember-auto-import/babel-plugin')],
...(CONCAT_STATS ? { sourceMaps: 'inline' } : {}),
},
};
Expand Down
81 changes: 76 additions & 5 deletions client/web/emberclear/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ const { buildWorkerTrees } = require('./config/build/workers');
const crypto = require('crypto');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;

const { EMBROIDER, CONCAT_STATS } = process.env;
let { EMBROIDER, CONCAT_STATS } = process.env;

if (EMBROIDER !== 'true') {
EMBROIDER = true;
}

module.exports = function (defaults) {
let environment = EmberApp.env();
Expand Down Expand Up @@ -113,15 +117,82 @@ module.exports = function (defaults) {

return compatBuild(app, Webpack, {
extraPublicTrees: additionalTrees,
// staticAddonTestSupportTrees: true,
// staticAddonTrees: true,
// staticHelpers: true,
// staticComponents: true,
staticAddonTestSupportTrees: true,
staticAddonTrees: true,
staticHelpers: true,
staticComponents: true,
// splitAtRoutes: true,
// skipBabel: [],
packageRules: [
{
package: 'ember-intl',
semverRange: '^4.3.2',
addonModules: {
'services/intl.js': {
dependsOnModules: ['../adapters/default.js'],
},
},
},
{
package: 'ember-cli-clipboard',
addonModules: {
'components/copy-button.js': {},
},
components: {
'{{copy-button}}': {
layout: {
addonPath: 'templates/components/copy-button.hbs',
},
acceptsComponentArguments: [
'clipboardText',
'clipboardTarget',
'clipboardAction',
'success',
'error',
'buttonType',
],
},
},
},
// {
// package: 'ember-destroyable-polyfill',
// semverRange: '^0.4.0',
// addonModules: {
// '-internal/patch-meta':{
// dependsO
// }
// }
// }
],
compatAdapters: new Map([
['@ember-data/model', EmberDataCompatAdapter],
['@ember-data/model', EmberDataCompatAdapter],
['@ember-data/store', EmberDataCompatAdapter],
['@ember-data/record-data', EmberDataCompatAdapter],
['ember-destroyable-polyfill', EmberDestroyableCompatAdapter],
]),
});
}

// Old-style broccoli-build
return mergeTrees([app.toTree(), ...additionalTrees]);
};

const { V1Addon } = require('@embroider/compat');
const { forceIncludeModule } = require('@embroider/compat/src/compat-utils');

class EmberDataCompatAdapter extends V1Addon {
get packageMeta() {
return forceIncludeModule(super.packageMeta, './-private');
}
}

class EmberDestroyableCompatAdapter extends V1Addon {
get packageMeta() {
let meta = super.packageMeta;
meta = forceIncludeModule(meta, './-internal/patch-core-object');
meta = forceIncludeModule(meta, './-internal/patch-meta');

return meta;
}
}
Loading

0 comments on commit 4a64bf0

Please sign in to comment.