This repository has been archived by the owner on Mar 13, 2020. It is now read-only.
forked from CSS-Electronics/cancloud
-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
114 lines (110 loc) · 2.7 KB
/
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
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
/*
* CSS Cloud Storage browser.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const webpack = require("webpack");
const HtmlWebPackPlugin = require("html-webpack-plugin");
const path = require("path");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const htmlPlugin = new HtmlWebPackPlugin({
template: "./src/browser/index.html",
filename: "./index.html",
title: "CANcloud-S3 Storage Browser"
});
const definePlugin = new webpack.DefinePlugin({
EDITOR: JSON.stringify({ offline: false })
});
const copyPlugin = new CopyWebpackPlugin([
{ from: "src/browser/img/browsers/chrome.png", to: "images" },
{ from: "src/browser/img/browsers/firefox.png", to: "images" },
{ from: "src/browser/img/browsers/safari.png", to: "images" }
]);
module.exports = {
context: __dirname,
entry: [path.resolve(__dirname, "src/browser/index.js")],
output: {
path: __dirname + "/site",
filename: "js/[hash].js"
},
resolve: {
extensions: [".js", ".jsx", ".less"]
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: "babel-loader"
}
},
{
test: /\.less$/,
use: [
{
loader: "style-loader"
},
{
loader: "css-loader"
},
{
loader: "less-loader"
}
]
},
{
test: /\.css$/,
use: [
{
loader: "style-loader"
},
{
loader: "css-loader"
}
]
},
{
test: /\.(png|jpg|gif|svg|ico)$/,
use: [
{
loader: "file-loader?limit=1024&name=images/[name].[ext]"
}
]
},
{
test: /\.svg/,
use: {
loader: "svg-url-loader",
options: {}
}
},
{
test: /\.(eot|woff|woff2|ttf|svg)/,
use: [
{
loader: "url-loader?limit=1024&name=fonts/[name].[ext]"
}
]
}
]
},
node: {
fs: "empty"
},
plugins: [htmlPlugin, copyPlugin, definePlugin],
devServer: {
historyApiFallback: true,
contentBase: "./"
}
};