This repository has been archived by the owner on Oct 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
ember-cli-build.js
112 lines (91 loc) · 2.76 KB
/
ember-cli-build.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
'use strict';
const {Webpack} = require('@embroider/webpack');
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const nodeSass = require('node-sass');
const browsers = require('./config/targets').browsers;
const {asBoolean} = require('./config/utils');
const IS_TEST_ENVIRONMENT = EmberApp.env() === 'test';
const IS_PRODUCTION_ENVIRONMENT = EmberApp.env() === 'production';
const buildFingerPrintPrepend = ({ASSETS_CDN_HOST, ASSETS_CDN_PROTOCOL, ASSETS_CDN_PATH}) => {
if (!ASSETS_CDN_HOST || !ASSETS_CDN_PROTOCOL) return '';
return `${ASSETS_CDN_PROTOCOL}://${ASSETS_CDN_HOST}/${ASSETS_CDN_PATH}/`;
};
const runtimeEnvironment = require('./config/runtime-environment');
module.exports = function (defaults) {
const app = new EmberApp(defaults, {
'hinting': false,
'tests': IS_TEST_ENVIRONMENT,
// NOTE: This is where `{{content-for "environment-variables"}}` in
// `app/index.html` is replaced with the runtime environment. We have to do
// this so that Ember.js default FastBoot server (`ember server`) has a
// runtime environment.
//
// This requires the `ember-cli-inline-content` NPM package.
'inlineContent': {
'environment-variables': {
content: runtimeEnvironment.html,
},
},
'autoImport': {
exclude: ['graphql-tag'],
},
'autoprefixer': {
sourcemap: false,
overrideBrowserslist: [...browsers],
},
'babel': {
plugins: [require('ember-auto-import/babel-plugin')],
sourceMaps: 'inline',
},
'cssModules': {
intermediateOutputPath: 'app/styles/app.scss',
extension: 'scss',
postcssOptions: {
syntax: require('postcss-scss'),
},
},
'emberApolloClient': {
keepGraphqlFileExtension: true,
},
'ember-fetch': {
preferNative: true,
},
'fingerprint': {
extensions: ['js', 'css', 'png', 'jpg', 'gif', 'map', 'svg'],
generateAssetMap: true,
},
'sassOptions': {
implementation: nodeSass,
},
'sourcemaps': {
enabled: true,
extensions: ['js'],
},
'svgJar': {
optimizer: false,
persist: false,
},
});
app.import('node_modules/simple-css-reset/reset.css');
app.import('node_modules/focus-visible/dist/focus-visible.js');
return require('@embroider/compat').compatBuild(app, Webpack, {
staticAddonTestSupportTrees: true,
staticAddonTrees: true,
staticHelpers: true,
staticComponents: true,
splitAtRoutes: [],
packagerOptions: {
publicAssetURL: buildFingerPrintPrepend(process.env),
webpackConfig: {
module: {
rules: [
{
test: /\.(graphql|gql)$/,
use: 'graphql-tag/loader',
},
],
},
},
},
});
};