forked from openedx/frontend-app-authoring
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwebpack.dev.config.js
More file actions
37 lines (35 loc) · 1.24 KB
/
webpack.dev.config.js
File metadata and controls
37 lines (35 loc) · 1.24 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
const path = require('path');
const { createConfig } = require('@openedx/frontend-build');
// eslint-disable-next-line import/no-extraneous-dependencies
const webpack = require('webpack');
const config = createConfig('webpack-dev', {
resolve: {
alias: {
// Within this app, we can use '@src/foo instead of relative URLs like '../../../foo'
'@src': path.resolve(__dirname, 'src/'),
// Plugins can use 'CourseAuthoring' as an import alias for this app:
CourseAuthoring: path.resolve(__dirname, 'src/'),
},
fallback: {
fs: false,
constants: false,
},
},
// Silently ignore “module not found” errors for that exact specifier.
plugins: [
new webpack.NormalModuleReplacementPlugin(
/@edx\/frontend-plugin-notifications/,
(resource) => {
try {
// Try to resolve the real package. If it exists, do nothing.
require.resolve('@edx/frontend-plugin-notifications');
} catch (e) {
// Package not found → point to the stub we created.
// eslint-disable-next-line no-param-reassign
resource.request = path.resolve(__dirname, 'src/stubs/empty-notifications-plugin.tsx');
}
},
),
],
});
module.exports = config;