forked from AMoreaux/Sketch-Icons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.skpm.config.js
38 lines (31 loc) · 994 Bytes
/
webpack.skpm.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
36
37
38
'use strict'
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const merge = require('lodash.merge');
const { skpm } = require('./package.json');
const pluginResourcesPath = `${skpm.main}/Contents/Resources`;
const pluginSketchPath = `${skpm.main}/Contents/Sketch`;
const ressourcesConfig = {
plugins: [
new CopyWebpackPlugin([
{
from: path.resolve('./resources/webview/webview.html'),
to: path.resolve(pluginResourcesPath)
},
{
from: path.resolve('./resources/SketchIconsFramework.framework'),
to: path.resolve(`${pluginSketchPath}/SketchIconsFramework.framework/[name].[ext]`)
},
{
from: path.resolve('./resources/icons'),
to: path.resolve(`${pluginResourcesPath}/icons`)
}
])
]
};
module.exports = function (config, isPluginCommand) {
config.resolve.extensions = ['.js', '.jsx'];
if (isPluginCommand) {
merge(config, ressourcesConfig)
}
};