-
Notifications
You must be signed in to change notification settings - Fork 188
Expand file tree
/
Copy pathrollup.config.mjs
More file actions
115 lines (103 loc) · 3.76 KB
/
rollup.config.mjs
File metadata and controls
115 lines (103 loc) · 3.76 KB
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
113
114
115
import { babel } from '@rollup/plugin-babel';
import { Addon } from '@embroider/addon-dev/rollup';
import { fileURLToPath } from 'node:url';
import { resolve, dirname } from 'node:path';
import sass from 'rollup-plugin-sass';
import postcss from 'postcss';
const addon = new Addon({
srcDir: 'src',
destDir: 'dist',
});
const rootDirectory = dirname(fileURLToPath(import.meta.url));
const babelConfig = resolve(rootDirectory, './babel.publish.config.cjs');
const tsConfig = resolve(rootDirectory, './tsconfig.publish.json');
export default [
{
input: './ember-basic-dropdown-for-css-generate.scss',
output: {
file: './src/vendor/ember-basic-dropdown.js',
assetFileNames: '[name][extname]',
},
plugins: [
sass({
api: 'modern',
output: './src/vendor/ember-basic-dropdown.css',
}),
],
},
{
input: './ember-basic-dropdown-for-css-generate.scss',
output: {
file: './src/vendor/ember-basic-dropdown.js',
assetFileNames: '[name][extname]',
},
plugins: [
sass({
api: 'modern',
processor: (css) =>
postcss()
.process(css, {
from: undefined,
})
.then((result) => result.css),
}),
],
},
{
// This provides defaults that work well alongside `publicEntrypoints` below.
// You can augment this if you need to.
output: addon.output(),
plugins: [
// These are the modules that users should be able to import from your
// addon. Anything not listed here may get optimized away.
// By default all your JavaScript modules (**/*.js) will be importable.
// But you are encouraged to tweak this to only cover the modules that make
// up your addon's public API. Also make sure your package.json#exports
// is aligned to the config here.
// See https://github.com/embroider-build/embroider/blob/main/docs/v2-faq.md#how-can-i-define-the-public-exports-of-my-addon
addon.publicEntrypoints([
'index.js',
'config.js',
'styles.js',
'components/**/*.js',
'modifiers/**/*.js',
'test-support/**/*.js',
'utils/**/*.js',
'vendor/**/*.js',
]),
// These are the modules that should get reexported into the traditional
// "app" tree. Things in here should also be in publicEntrypoints above, but
// not everything in publicEntrypoints necessarily needs to go here.
addon.appReexports(['components/**/*.js', 'modifiers/**/*.js']),
// Follow the V2 Addon rules about dependencies. Your code can import from
// `dependencies` and `peerDependencies` as well as standard Ember-provided
// package names.
addon.dependencies(),
// This babel config should *not* apply presets or compile away ES modules.
// It exists only to provide development niceties for you, like automatic
// template colocation.
//
// By default, this will load the actual babel config from the file
// babel.config.json.
babel({
extensions: ['.js', '.gjs', '.ts', '.gts'],
babelHelpers: 'bundled',
configFile: babelConfig,
}),
// Ensure that standalone .hbs files are properly integrated as Javascript.
addon.hbs(),
// Ensure that .gjs files are properly integrated as Javascript
addon.gjs(),
// Emit .d.ts declaration files
addon.declarations(
'declarations',
`pnpm ember-tsc --declaration --project ${tsConfig}`,
),
// addons are allowed to contain imports of .css files, which we want rollup
// to leave alone and keep in the published output.
addon.keepAssets(['**/*.css']),
// Remove leftover build artifacts when starting a new build.
addon.clean(),
],
},
];