دنبال کننده ها

۱۳۹۶ اسفند ۲۸, دوشنبه

javascript - Webpack 4 Handle Hashbang in Banner with BannerPlugin: 'Unexpected character '#'... Multiple solutions tried and failed

[ad_1]


const webpack = require("webpack");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const autoprefixer = require("autoprefixer");
const path = require('path');

const browserConfig =
entry: "./src/browser/index.js",
output:
path: __dirname,
filename: "./public/bundle.js"
,
devtool: "cheap-module-source-map",
module:
rules: [

test: [/.svg$/, /.gif$/, /.jpe?g$/, /.png$/],
loader: "file-loader",
options:
name: "public/media/[name].[ext]",
publicPath: url => url.replace(/public/, "")

,

test: /.css$/,
use: ExtractTextPlugin.extract(
use: [

loader: "css-loader",
options: importLoaders: 1
,

loader: "postcss-loader",
options: plugins: [autoprefixer()]

]
)
,

test: /js$/,
use: [

loader: "remove-hashbag-loader"
,

loader: "babel-loader"

],
query: presets: ["react-app"]

]
,
plugins: [
new ExtractTextPlugin(
filename: "public/css/[name].css"
)
]
;

const serverConfig =
entry: "./src/server/index.js",
target: "node",
output:
path: __dirname,
filename: "server.js",
libraryTarget: "commonjs2"
,
devtool: "cheap-module-source-map",
module:
rules: [

test: [/.svg$/, /.gif$/, /.jpe?g$/, /.png$/],
loader: "file-loader",
options:
name: "public/media/[name].[ext]",
publicPath: url => url.replace(/public/, ""),
emit: false

,

test: /.css$/,
use: [

loader: "css-loader/locals"

]
,

test: /js$/,
use: [

loader: "remove-hashbag-loader"
,

loader: "babel-loader"

],
query: presets: ["react-app"]

]
,
resolveLoader:
alias:
"remove-hashbag-loader": path.join(__dirname, "./loaders/remove-hashbag-loader")


;

module.exports = [browserConfig, serverConfig];



[ad_2]

لینک منبع