# All files / src/webpack index.js

95% Statements 19/20
47.06% Branches 8/17
0% Functions 0/1
100% Lines 19/19

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    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
    412x

    2x

    2x
    2x

    2x

    2x

    2x
    2x

    2x

    2x
    2x
    2x

    2x
    2x
    2x
    2x

    2x

    2x
    2x
     const babelServer = require("./inc/babel-server-rule")({
      cacheDirectory: false
    }).use.options;

    require("@babel/register")({
      presets: babelServer.presets.default?babelServer.presets.default: babelServer.presets,
      plugins: babelServer.plugins,
      cache: false,
      ignore: [
        /node_modules\/(?!(weby|pawjs|imli|paw|webyjs|imlijs)).*/
      ]
    });

    const fs = require("fs");
    const path = require("path");

    const env = typeof process.env.NODE_ENV !== "undefined" ?
      process.env.NODE_ENV : "development";
    const type = typeof process.env.WEBPACK_TARGET !== "undefined" ?
      process.env.WEBPACK_TARGET: "web";

    let WebpackHandler = require("./handler");
    WebpackHandler = WebpackHandler.default? WebpackHandler.default: WebpackHandler;

    const handler = new WebpackHandler();

    const processDir = process.cwd();
    let project_root = process.env.__project_root || process.env.PROJECT_ROOT || (processDir + path.sep);
    project_root = path.isAbsolute(project_root) ? project_root: path.resolve(processDir, project_root);

    Eif (fs.existsSync(path.join(project_root, "src", "webpack.js"))) {
      let ProjectWebpackPlugin = require(path.join(project_root, "src" ,"webpack.js"));
      Eif (ProjectWebpackPlugin.default) {
        ProjectWebpackPlugin = ProjectWebpackPlugin.default;
      }
      handler.addPlugin(new ProjectWebpackPlugin({addPlugin: handler.addPlugin}));
    }

    module.exports = () => handler.getConfig(env, type);
    module.exports.handler = handler;