UNPKG

1.43 kBJavaScriptView Raw
1/** * webpack.config.js ** */
2const path = require('path');
3const HtmlWebpackPlugin = require('html-webpack-plugin');
4
5const htmlWebpackPlugin = new HtmlWebpackPlugin({
6 template: path.join(__dirname, 'examples/src/index.html'),
7 filename: 'examples/index.html',
8});
9module.exports = {
10 entry: path.join(__dirname, 'examples/src/index.js'),
11 externals: {
12 'styled-components': {
13 commonjs: 'styled-components',
14 commonjs2: 'styled-components',
15 amd: 'styled-components',
16 },
17 },
18 output: {
19 path: path.join(__dirname, 'examples/dist'),
20 filename: 'bundle.js',
21 },
22 module: {
23 rules: [
24 {
25 test: /\.(js|jsx)$/,
26 use: 'babel-loader',
27 exclude: /node_modules/,
28 },
29 {
30 test: /\.css$/,
31 use: ['style-loader', 'css-loader'],
32 },
33 {
34 test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
35 loader: require.resolve('url-loader'),
36 options: {
37 limit: 10000,
38 name: 'static/media/[name].[hash:8].[ext]',
39 },
40 },
41 {
42 test: [/\.eot$/, /\.ttf$/, /\.svg$/, /\.woff$/, /\.woff2$/],
43 loader: require.resolve('file-loader'),
44 options: {
45 name: 'static/media/[name].[hash:8].[ext]',
46 },
47 },
48 ],
49 },
50 node: {
51 fs: 'empty'
52 },
53 plugins: [htmlWebpackPlugin],
54 resolve: {
55 extensions: ['.js', '.jsx'],
56 },
57 devServer: {
58 port: 3001,
59 },
60};