-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathember-cli-build.js
101 lines (96 loc) · 2.97 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
'use strict';
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const { compatBuild } = require('@embroider/compat');
const { Webpack } = require('@embroider/webpack');
const webpack = require('webpack');
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
const MomentLocalesPlugin = require('moment-locales-webpack-plugin');
const { GlimmerScopedCSSWebpackPlugin } = require('glimmer-scoped-css/webpack');
const withSideWatch = require('./lib/with-side-watch');
module.exports = function (defaults) {
const app = new EmberApp(defaults, {
trees: {
app: withSideWatch('app', {
watching: ['../runtime-common', '../boxel-ui/addon'],
}),
},
'ember-cli-babel': {
enableTypeScriptTransform: true,
disableDecoratorTransforms: true,
},
babel: {
plugins: [[require.resolve('decorator-transforms')]],
},
});
return compatBuild(app, Webpack, {
staticAddonTrees: true,
staticAddonTestSupportTrees: true,
staticHelpers: true,
staticComponents: true,
staticModifiers: true,
staticAppPaths: ['lib'],
packagerOptions: {
...{
webpackConfig: {
devtool: 'source-map',
module: {
rules: [
{
test: /\.ttf$/,
type: 'asset/inline',
},
{
test: /\.woff2$/,
type: 'asset',
},
{
test: /\.png$/,
type: 'asset',
},
{
test: /\.webp$/,
type: 'asset',
},
{
test: /\.otf$/,
type: 'asset',
},
],
},
plugins: [
new GlimmerScopedCSSWebpackPlugin(),
new MonacoWebpackPlugin(),
new webpack.ProvidePlugin({
process: 'process',
}),
new webpack.IgnorePlugin({
resourceRegExp: /^https:\/\/cardstack\.com\/base/,
}),
new MomentLocalesPlugin({
// 'en' is built into moment and cannot be removed. This strips the others.
localesToKeep: [],
}),
],
resolve: {
fallback: {
fs: false,
os: false,
path: require.resolve('path-browserify'),
crypto: require.resolve('crypto-browserify'),
stream: require.resolve('stream-browserify'),
process: false,
},
alias: {
'matrix-js-sdk$': 'matrix-js-sdk/src/browser-index.ts', // Consume matrix-js-sdk via Typescript ESM so that code splitting works to exlcude massive matrix-sdk-crypto-wasm from the main bundle
'matrix-js-sdk/src/sliding-sync':
'matrix-js-sdk/src/sliding-sync.ts',
},
},
node: {
global: true,
},
},
},
},
});
};