X
X
xymox72h2019-08-19 15:24:40
webpack
xymox72h, 2019-08-19 15:24:40

How not to transform entry file in Webpack?

There is a config.

const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const VueLoaderPlugin = require("vue-loader/lib/plugin");
const {resolve, isLocal, modules} = require("./utils");
const alias = require("./alias");
const webpack = require("webpack");


const { CleanWebpackPlugin } = require("clean-webpack-plugin");

module.exports = {
  entry: {
    app: "./src/main.js",
    links: "./statics/links.js"
  },
  output: {
    path: resolve("../dist"),
    filename: "[name].js",
    chunkFilename: "[id].chunk.js",
    publicPath: isLocal() ? "/" : "/lko-vue/"
  },
  resolve: {
    extensions: [".js", ".jsx", ".vue", "json"],
    alias
  },
  module: {
    rules: [
      {
        test: /\.(js|jsx)$/,
        exclude: /node_modules/,
        use: "babel-loader"
      },
      {
        test: /\.vue$/,
        loader: "vue-loader",
        options: {
          loaders: {
            js: "babel-loader"
          }
        }
      },
      {
        test: /\.scss$/,
        use: modules.scss
      },
      {
        test: /\.css$/,
        use: [
          MiniCssExtractPlugin.loader,
          "css-loader"
        ]
      }
    ]
  },
  plugins: [
    new MiniCssExtractPlugin({filename: "[name].css"}),
    new VueLoaderPlugin(),
    new CleanWebpackPlugin(),
  ]
};

I want the links.js output file to be without changes and transformations, so that it can be dynamically replaced without compiling.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question