forked from adopted-ember-addons/ember-drag-sort
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.mjs
More file actions
65 lines (53 loc) · 2.04 KB
/
Copy pathrollup.config.mjs
File metadata and controls
65 lines (53 loc) · 2.04 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
import { babel } from '@rollup/plugin-babel';
import { Addon } from '@embroider/addon-dev/rollup';
import { fileURLToPath } from 'node:url';
import { resolve, dirname } from 'node:path';
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 {
// 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.
addon.publicEntrypoints(['**/*.js', 'index.js']),
// These are the modules that should get reexported into the traditional
// "app" tree.
addon.appReexports([
'components/**/*.js',
'helpers/**/*.js',
'modifiers/**/*.js',
'services/**/*.js',
]),
// Follow the V2 Addon rules about dependencies.
addon.dependencies(),
// Ensure that standalone .hbs files are properly integrated as Javascript.
addon.hbs(),
// Ensure that .gjs/.gts files are properly integrated as Javascript.
// Must run before babel so template tags are extracted before TS parsing.
addon.gjs(),
// This babel config should *not* apply presets or compile away ES modules.
babel({
extensions: ['.js', '.gjs', '.ts', '.gts'],
babelHelpers: 'bundled',
configFile: babelConfig,
}),
// Emit .d.ts declaration files
!process.env.SKIP_DECLARATIONS &&
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(),
],
};