| /** |
| * Licensed to the Apache Software Foundation (ASF) under one |
| * or more contributor license agreements. See the NOTICE file |
| * distributed with this work for additional information |
| * regarding copyright ownership. The ASF licenses this file |
| * to you 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 path = require("path"); |
| const MiniCssExtractPlugin = require("mini-css-extract-plugin"); |
| const AssetsPlugin = require("assets-webpack-plugin"); |
| |
| module.exports = { |
| entry: { |
| main: path.join(__dirname, "src", "index.js"), |
| docs: path.join(__dirname, "src", "docs-index.js") |
| }, |
| |
| output: { |
| path: path.join(__dirname, "dist"), |
| publicPath: "/" |
| }, |
| |
| module: { |
| rules: [ |
| { |
| test: /\.((png)|(eot)|(woff)|(woff2)|(ttf)|(svg)|(gif))(\?v=\d+\.\d+\.\d+)?$/, |
| loader: "file-loader?name=/[hash].[ext]" |
| }, |
| |
| {test: /\.json$/, loader: "json-loader"}, |
| |
| { |
| loader: "babel-loader", |
| test: /\.js?$/, |
| exclude: /node_modules/, |
| query: {cacheDirectory: true} |
| }, |
| |
| { |
| test: /\.(sa|sc|c)ss$/, |
| exclude: /node_modules/, |
| use: ["style-loader", MiniCssExtractPlugin.loader, "css-loader", "postcss-loader", "sass-loader"] |
| } |
| ] |
| }, |
| |
| plugins: [ |
| new webpack.ProvidePlugin({ |
| fetch: "exports-loader?self.fetch!whatwg-fetch/dist/fetch.umd", |
| }), |
| |
| new AssetsPlugin({ |
| filename: "webpack.json", |
| path: path.join(process.cwd(), "site/data"), |
| prettyPrint: true |
| }) |
| ] |
| }; |