我的webpack开发服务器有问题。首先,我显示我的代码。
dev.ts
void findMinMaxStr(char word[][40], char *first, char *last,int size)
{
int i;
char* first_ptr = word[0];
char* last_ptr = word[0];
for(i=0;i<size;i++){
if(strcmp(last_ptr,word[i])<0)
last_ptr = word[i];
if(strcmp(first_ptr,word[i])>0)
first_ptr = word[i];
}
strcpy(first,first_ptr);
strcpy(last,last_ptr);
}
我的脚本:“ dev”:“ webpack-dev-server --config =。/ config / webpack / dev.ts --hot --history-api-fallback --disable-host-check --host = 0.0.0.0 --port = $ PORT“
如何解决此错误?
import webpack from 'webpack'
import autoprefixer from 'autoprefixer'
import htmlTemplate from 'html-webpack-template'
import HtmlWebpackPlugin from 'html-webpack-plugin'
export const mode = 'development'
export const entry = ['@babel/polyfill', './src/index']
export const output = {
filename: '[name].js',
publicPath: '/',
path: '/',
}
export const devServer = {
port: 3000
}
export const module = {
rules: [
{
test: /\.(js|ts|tsx)$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
query: {
babelrc: false,
presets: [
[
'@babel/preset-env',
{
targets: {
browsers: '> 0.25%, not dead',
},
useBuiltIns: 'usage',
modules: false,
},
],
'@babel/preset-typescript',
'@babel/preset-react',
],
plugins: [
'react-hot-loader/babel',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-syntax-dynamic-import',
],
},
},
],
},
{
test: /\.css$/,
use: [
'style-loader',
'css-loader',
{
loader: 'postcss-loader',
options: {
plugins: () => [
autoprefixer({
overrideBrowserslist: ['>2%', 'last 2 versions'],
}),
],
},
},
],
},
{
test: /\.(png|jpg|svg|ttf|eot|woff|woff2)$/,
loader: 'file-loader?name=[name].[ext]',
},
],
}
export const resolve = {
extensions: ['.ts', '.tsx', '.js', '.json'],
}
export const plugins = [
new HtmlWebpackPlugin({
title: 'Atlantis United',
inject: false,
template: htmlTemplate,
appMountId: 'app',
}),
]