클라이언트 측과 서버 측에서 폴더를 분할했지만 상위 폴더에서 작업하지 못했습니다. 두 개의 다른 것처럼 작동합니다. 폴더 ... 지금은 Heroku에 배포하고 싶지만 그 때문에 내 새 루트 폴더에서 스크립트를 실행할 수 있도록 webpack.config를 변경하려고 한 주 폴더가 필요합니다. 나는 나에게 도움이되지 않았다 이러한 솔루션을 시도, 내가 해결하기 위해 알아낼 수있는 마지막 오류를 받고 있어요 중 하나ERROR in ./~ /constants-browserify/constants.json
ERROR in ./~/constants-browserify/constants.json
Module parse failed: /Users/Documents/Twitch/testbot/node_modules/constants-browserify/constants.json Unexpected token (2:12)
You may need an appropriate loader to handle this file type.
| {
| "O_RDONLY": 0,
| "O_WRONLY": 1,
| "O_RDWR": 2,
@ ./src/js/reducers/chat.js 1:0-50
@ ./src/js/script.js
@ multi main
이것은 내가지고있어 오류입니다 이 오류
import {CHAT_MESSAGE_RECEIVED} from 'constants';
const chatReducer = (state = [], action) => {
switch(action.type){
case CHAT_MESSAGE_RECEIVED:
console.log(state, action);
return [...state, action.payload];
default:
return state;
}
};
export default chatReducer;
,536에 나와있는 감속기는
// changed some loader syntax after reading
// https://webpack.js.org/how-to/upgrade-from-webpack-1/
const path = require(`path`);
const webpack = require(`webpack`);
const {UglifyJsPlugin} = webpack.optimize;
const CopyWebpackPlugin = require(`copy-webpack-plugin`);
const ExtractTextWebpackPlugin = require(`extract-text-webpack-plugin`);
const configHtmls = require(`webpack-config-htmls`)();
const extractCSS = new ExtractTextWebpackPlugin(`css/style.css`);
// change for production build on different server path
const publicPath = `/`;
// hard copy assets folder for:
// - srcset images (not loaded through html-loader)
// - json files (through fetch)
// - fonts via WebFontLoader
const copy = new CopyWebpackPlugin([{
from: `./src/assets`,
to: `assets`
}], {
ignore: [ `.DS_Store` ]
});
const config = {
entry: [
`./src/css/style.css`,
`./src/js/script.js`
],
resolve: {
// import files without extension import ... from './Test'
extensions: [`.js`, `.jsx`, `.css`]
},
output: {
path: path.join(__dirname, `server`, `public`),
filename: `js/[name].[hash].js`,
publicPath
},
devtool: `sourcemap`,
module: {
rules: [
{
test: /\.css$/,
loader: extractCSS.extract([
{
loader: `css`,
options: {
importLoaders: 1
}
},
{
loader: `postcss`
}
])
},
{
test: /\.html$/,
loader: `html`,
options: {
attrs: [
`audio:src`,
`img:src`,
`video:src`,
`source:srcset`
] // read src from video, img & audio tag
}
},
{
test: /\.(jsx?)$/,
exclude: /node_modules/,
use: [
{
loader: `babel`
},
{
loader: `eslint`,
options: {
fix: true
}
}
]
},
{
test: /\.(svg|png|jpe?g|gif|webp)$/,
loader: `url`,
options: {
limit: 1000, // inline if < 1 kb
context: `./src`,
name: `[path][name].[ext]`
}
},
{
test: /\.(mp3|mp4)$/,
loader: `file`,
options: {
context: `./src`,
name: `[path][name].[ext]`
}
}
]
},
plugins: [
extractCSS,
copy
]
};
if(process.env.NODE_ENV === `production`){
//image optimizing
config.module.rules.push({
test: /\.(svg|png|jpe?g|gif)$/,
loader: `image-webpack`,
enforce: `pre`
});
config.plugins = [
...config.plugins,
new UglifyJsPlugin({
sourceMap: true, // false returns errors.. -p + plugin conflict
comments: false
})
];
}
config.plugins = [...config.plugins, ...configHtmls.plugins];
module.exports = config;
: 그리고 이것은 내 webpack.config.js입니다
이 오류를 해결하기 위해 내가 잘못하고있는 것에 대한 아이디어가 있습니까?
오류 메시지를 직접 질문에 붙여 넣으면 다른 사람들이 검색 할 때이 질문을 더 쉽게 찾을 수 있습니다 (이미지를로드 할 때까지 기다릴 필요가 없기 때문에 질문에 답변하는 사람들을위한 시간을 절약 할 수 있습니다) . – Aurora0001
나는 내 질문에 오류의 첫 줄을 입력하여 그 일을했다고 생각 했습니까? 어떤 부분을 추가 하시겠습니까? 바로 편집하겠습니다. – Kevin
터미널에있는 전체 오류 메시지 (현재 이미지로 사용하고 있음)를 의미했습니다. 그것은 단지 귀하의 질문에 그것을 가지고 더 나은 것으로 간주되므로 읽기 쉽고 이미지가 제거되면 링크 썩음으로 고통받을 수 없습니다. – Aurora0001