|
| 1 | +const path = require('path'); |
| 2 | +const webpack = require('webpack'); |
| 3 | +const Dotenv = require('dotenv-webpack'); |
| 4 | + |
| 5 | +module.exports = { |
| 6 | + mode: 'development', |
| 7 | + context: __dirname, |
| 8 | + |
| 9 | + devtool: 'source-map', |
| 10 | + entry: [ |
| 11 | + './index.js', |
| 12 | + ], |
| 13 | + |
| 14 | + output: { |
| 15 | + path: path.resolve(__dirname, 'build'), |
| 16 | + filename: 'bundle.js', |
| 17 | + }, |
| 18 | + devServer: { |
| 19 | + static: path.resolve(__dirname, 'build'), |
| 20 | + compress: true, |
| 21 | + historyApiFallback: false, |
| 22 | + port: 3000 |
| 23 | + }, |
| 24 | + plugins: [ |
| 25 | + new Dotenv({path: path.resolve(__dirname, '.env'), systemvars: true}), |
| 26 | + new webpack.LoaderOptionsPlugin({ |
| 27 | + debug: true |
| 28 | + }) |
| 29 | + ], |
| 30 | + resolve: { |
| 31 | + alias: { |
| 32 | + "@terminusdb/terminusdb-access-control-component": path.join(__dirname, '..', 'src/index.js'), |
| 33 | + "@terminusdb/terminusdb-client": path.resolve('../terminusdb-client/index.js'), |
| 34 | + "@terminusdb/terminusdb-react-table": path.resolve('../terminusdb-react-table/src/index.js'), |
| 35 | + react: path.resolve('./node_modules/react') |
| 36 | + }, |
| 37 | + extensions: ['.js', '.jsx', '.json', '.css'], |
| 38 | + }, |
| 39 | + module: { |
| 40 | + |
| 41 | + rules : [{ |
| 42 | + test: /\.js$/, |
| 43 | + exclude: /node_modules/, |
| 44 | + loader: 'babel-loader', |
| 45 | + include: [__dirname, path.join(__dirname, '..', 'src')], |
| 46 | + }, |
| 47 | + { |
| 48 | + test: /\.js$/, |
| 49 | + exclude: /node_modules/, |
| 50 | + use: { |
| 51 | + loader:"babel-loader", |
| 52 | + options:{ |
| 53 | + sourceType: "unambiguous", |
| 54 | + presets: [ |
| 55 | + ["@babel/preset-env"], |
| 56 | + "@babel/preset-react" |
| 57 | + ], |
| 58 | + plugins: [[ |
| 59 | + "@babel/plugin-proposal-class-properties", |
| 60 | + { |
| 61 | + "loose": true |
| 62 | + } |
| 63 | + ],"@babel/plugin-transform-react-jsx", |
| 64 | + "@babel/plugin-proposal-export-default-from","@babel/plugin-transform-regenerator", |
| 65 | + ["@babel/plugin-transform-runtime"] |
| 66 | + ] |
| 67 | + } |
| 68 | + }, |
| 69 | + }, |
| 70 | + { |
| 71 | + test: /\.css$/, |
| 72 | + exclude: /node_modules/, |
| 73 | + use: ['style-loader', 'css-loader'], |
| 74 | + }] |
| 75 | + } |
| 76 | +}; |
0 commit comments