Commit 6c7f2452 authored by 张烨's avatar 张烨

ci: 🎡 add copy-plugin to copy public assets

parent c065213b
const path = require('path'); const path = require('path');
const webpack = require('webpack'); const webpack = require('webpack');
const slash = require('slash2'); const slash = require('slash2');
const CopyPlugin = require('copy-webpack-plugin');
module.exports = options => ({ module.exports = options => ({
mode: options.mode, mode: options.mode,
entry: options.entry, entry: options.entry,
...@@ -158,6 +160,12 @@ module.exports = options => ({ ...@@ -158,6 +160,12 @@ module.exports = options => ({
new webpack.EnvironmentPlugin({ new webpack.EnvironmentPlugin({
NODE_ENV: 'development', NODE_ENV: 'development',
}), }),
new CopyPlugin([
{
from: path.resolve(process.cwd(), './public'),
},
]),
]), ]),
resolve: { resolve: {
modules: ['node_modules', 'src'], modules: ['node_modules', 'src'],
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
"preinstall": "npm run npmcheckversion", "preinstall": "npm run npmcheckversion",
"prebuild": "npm run build:clean", "prebuild": "npm run build:clean",
"build": "cross-env NODE_ENV=production webpack --config internals/webpack/webpack.prod.babel.js --color -p --progress --hide-modules --display-optimization-bailout", "build": "cross-env NODE_ENV=production webpack --config internals/webpack/webpack.prod.babel.js --color -p --progress --hide-modules --display-optimization-bailout",
"build:inspect": "cross-env NODE_ENV=production node --inspect-brk ./node_modules/webpack/bin/webpack.js --config internals/webpack/webpack.prod.babel.js --color -p --progress --hide-modules --display-optimization-bailout",
"build:clean": "rimraf ./build", "build:clean": "rimraf ./build",
"start": "cross-env NODE_ENV=development node --inspect=9229 server", "start": "cross-env NODE_ENV=development node --inspect=9229 server",
"start:tunnel": "cross-env NODE_ENV=development ENABLE_TUNNEL=true node server", "start:tunnel": "cross-env NODE_ENV=development ENABLE_TUNNEL=true node server",
...@@ -85,7 +86,8 @@ ...@@ -85,7 +86,8 @@
"chalk": "2.4.2", "chalk": "2.4.2",
"compression": "1.7.4", "compression": "1.7.4",
"connected-react-router": "6.4.0", "connected-react-router": "6.4.0",
"cross-env": "5.2.0", "copy-webpack-plugin": "5.0.0",
"cross-env": "5.0.0",
"express": "4.16.4", "express": "4.16.4",
"fontfaceobserver": "2.1.0", "fontfaceobserver": "2.1.0",
"history": "4.9.0", "history": "4.9.0",
......
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="index.html" />
<add value="Default.htm" />
<add value="Default.asp" />
<add value="index.htm" />
<add value="iisstart.htm" />
<add value="default.aspx" />
</files>
</defaultDocument>
<rewrite>
<rules>
<rule name="route1" stopProcessing="true">
<match url="\/index\.html$" ignoreCase="true" />
<action type="None" />
</rule>
<rule name="route2" stopProcessing="true">
<match url="." ignoreCase="true" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="\/index.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment