UNPKG

3.71 kBJavaScriptView Raw
1"use strict";
2var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3 if (k2 === undefined) k2 = k;
4 var desc = Object.getOwnPropertyDescriptor(m, k);
5 if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6 desc = { enumerable: true, get: function() { return m[k]; } };
7 }
8 Object.defineProperty(o, k2, desc);
9}) : (function(o, m, k, k2) {
10 if (k2 === undefined) k2 = k;
11 o[k2] = m[k];
12}));
13var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14 Object.defineProperty(o, "default", { enumerable: true, value: v });
15}) : function(o, v) {
16 o["default"] = v;
17});
18var __importStar = (this && this.__importStar) || function (mod) {
19 if (mod && mod.__esModule) return mod;
20 var result = {};
21 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22 __setModuleDefault(result, mod);
23 return result;
24};
25var __importDefault = (this && this.__importDefault) || function (mod) {
26 return (mod && mod.__esModule) ? mod : { "default": mod };
27};
28Object.defineProperty(exports, "__esModule", { value: true });
29// Copyright (c) Jupyter Development Team.
30// Distributed under the terms of the Modified BSD License.
31const webpack = __importStar(require("webpack"));
32const mini_svg_data_uri_1 = __importDefault(require("mini-svg-data-uri"));
33const rules = [
34 { test: /\.raw\.css$/, type: 'asset/source' },
35 { test: /(?<!\.raw)\.css$/, use: ['style-loader', 'css-loader'] },
36 { test: /\.txt$/, type: 'asset/source' },
37 { test: /\.md$/, type: 'asset/source' },
38 { test: /\.(jpg|png|gif)$/, type: 'asset/resource' },
39 { test: /\.js.map$/, type: 'asset/resource' },
40 {
41 test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
42 type: 'asset/resource'
43 },
44 {
45 test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
46 type: 'asset/resource'
47 },
48 {
49 test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
50 type: 'asset/resource'
51 },
52 { test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, type: 'asset/resource' },
53 {
54 // In .css files, svg is loaded as a data URI.
55 test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
56 issuer: /\.css$/,
57 type: 'asset',
58 generator: {
59 dataUrl: (content) => (0, mini_svg_data_uri_1.default)(content.toString())
60 }
61 },
62 {
63 // In .ts and .tsx files (both of which compile to .js), svg files
64 // must be loaded as a raw string instead of data URIs.
65 test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
66 issuer: /\.js$/,
67 type: 'asset/source'
68 },
69 {
70 test: /\.m?js$/,
71 type: 'javascript/auto'
72 },
73 {
74 test: /\.m?js/,
75 resolve: {
76 fullySpecified: false
77 }
78 },
79 {
80 test: /\.c?js/,
81 resolve: {
82 fullySpecified: false
83 }
84 }
85];
86const watch = process.argv.includes('--watch');
87module.exports = {
88 bail: !watch,
89 module: { rules },
90 resolve: {
91 fallback: {
92 url: false,
93 buffer: false,
94 crypto: false,
95 // See https://github.com/webpack/webpack/blob/3471c776059ac2d26593ea39f9c47c1874253dbb/lib/ModuleNotFoundError.js#L13-L42
96 path: require.resolve('path-browserify'),
97 process: require.resolve('process/browser')
98 }
99 },
100 watchOptions: {
101 poll: 500,
102 aggregateTimeout: 1000
103 },
104 output: {
105 hashFunction: 'sha256'
106 },
107 plugins: [
108 new webpack.ProvidePlugin({
109 process: 'process/browser'
110 })
111 ]
112};
113//# sourceMappingURL=webpack.config.base.js.map
\No newline at end of file