forked from halfnelson/svelte-native
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsvelte-native.webpack.config.js
35 lines (33 loc) · 1.08 KB
/
svelte-native.webpack.config.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
const webpackConfig = require("./webpack.config");
const svelteConfig = require('./svelte.config');
module.exports = env => {
const config = webpackConfig(env);
config.externals = (config.externals || []).filter(x => x != 'svelte' && x != 'svelte-native')
config.resolve.extensions = [".ts", ".mjs", ".js", ".svelte", ".scss", ".css"];
config.module.rules.push({
test: /\.mjs$/,
type: 'javascript/auto',
});
config.module.rules.push({
test: /\.svelte$/,
exclude: /node_modules/,
use: [
{
loader: 'svelte-loader',
options: {
...svelteConfig
}
}
]
});
// insert the mjs loader after ts-loader
/* const tsLoaderRule = config.module.rules.find(r => r.use.loader === "ts-loader");
const indexOfTsLoaderRule = config.module.rules.indexOf(tsLoaderRule);
const mjsRule = {
test: /\.mjs$/,
type: 'javascript/auto',
};
config.module.rules.splice(indexOfTsLoaderRule, 0, mjsRule);
*/
return config;
};