操作系统:Windows 10 Pro
webpack:1.14.0
sw-precache-webpack-plugin:0.9.1
sw-precache:5.0.0
所以,我启动我的网站并暂时不做任何事情,然后在devTools中生成上面指定的错误消息.如果执行某个过程,则不会出现错误
我的React代码如下:
webpack.config.prod.js
var path = require('path');
var webpack = require('webpack');
var SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
module.exports = {
devtool: 'source-map',
context: __dirname,
entry: {
main: path.resolve(__dirname, './client/app'),
},
output: {
path: path.join(__dirname, '/public'),
filename: 'bundle.js',
publicPath: '/public/'
},
plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': "'production'"
}
}),
new webpack.optimize.UglifyJsPlugin({
compressor: {
warnings: false
}
}),
new SWPrecacheWebpackPlugin(
{
cacheId: 'flamingoCity',
filename: 'my-service-worker.js',
stripPrefix: path.join(__dirname, 'public').replace(/\\/g,"/"),
maximumFileSizeToCacheInBytes: 6194304,
minify: true,
runtimeCaching: [{ …Run Code Online (Sandbox Code Playgroud)操作系统:Windows 10 Pro
webpack:1.14.0
因此,我收到上述错误,代码如下async:
import { applyAfterware, applyMiddleware } from 'redux';
async applyMiddleware(req, next) {
....
},
Run Code Online (Sandbox Code Playgroud)
完整的错误消息是:
Module parse failed: C:\Users\d0475\Documents\Projects\learn-redux-graphql\node_modules\babel-loader\lib\index.js!C:\Users\d0475\Documents\Projects\learn-redux-graphql\client\apolloClient.js Unexpected token (77:25)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (77:25)
at Parser.pp$4.raise (C:\Users\d0475\Documents\Projects\learn-redux-graphql\node_modules\acorn\dist\acorn.js:2221:15)
at Parser.pp.unexpected (C:\Users\d0475\Documents\Projects\learn-redux-graphql\node_modules\acorn\dist\acorn.js:603:10)
at Parser.pp.expect (C:\Users\d0475\Documents\Projects\learn-redux-graphql\node_modules\acorn\dist\acorn.js:597:28)
at Parser.pp$3.parseObj (C:\Users\d0475\Documents\Projects\learn-redux-graphql\node_modules\acorn\dist\acorn.js:1973:16)
at Parser.pp$3.parseExprAtom (C:\Users\d0475\Documents\Projects\learn-redux-graphql\node_modules\acorn\dist\acorn.js:1805:19)
at Parser.pp$3.parseExprSubscripts (C:\Users\d0475\Documents\Projects\learn-redux-graphql\node_modules\acorn\dist\acorn.js:1715:21)
at Parser.pp$3.parseMaybeUnary (C:\Users\d0475\Documents\Projects\learn-redux-graphql\node_modules\acorn\dist\acorn.js:1692:19)
at Parser.pp$3.parseExprOps (C:\Users\d0475\Documents\Projects\learn-redux-graphql\node_modules\acorn\dist\acorn.js:1637:21)
at Parser.pp$3.parseMaybeConditional (C:\Users\d0475\Documents\Projects\learn-redux-graphql\node_modules\acorn\dist\acorn.js:1620:21)
at Parser.pp$3.parseMaybeAssign (C:\Users\d0475\Documents\Projects\learn-redux-graphql\node_modules\acorn\dist\acorn.js:1597:21)
@ ./client/app.js 17:20-45
Run Code Online (Sandbox Code Playgroud)
我的 webpack.config 文件是:
var …Run Code Online (Sandbox Code Playgroud) 所以,我试图用 nounce 属性填充我的 next.js 项目中的样式组件,但没有成功。正在设置 CSP 的 style-src,但由于未在样式中设置 nounce,因此会引发错误。我还需要做什么才能完成这项工作?
到目前为止,我所拥有的如下:
服务器.js
server.use((req, res, next) => {
// nonce should be base64 encoded
res.locals.styleNonce = Buffer.from(uuidv4()).toString('base64')
next()
});
server.use('*', (req, res, next) => {
global.__webpack_nonce__ = res.locals.styleNonce;
next()
});
server.use(helmet.contentSecurityPolicy({
directives: {
styleSrc: ["'self'", (req, res) => `'nonce-${res.locals.styleNonce}'`],
}
}));
Run Code Online (Sandbox Code Playgroud)
_document.js
export default class MyDocument extends Document {
static getInitialProps({ renderPage }) {
const sheet = new ServerStyleSheet();
const page = renderPage(App => props => sheet.collectStyles(<App {...props} />));
const styleTags = …Run Code Online (Sandbox Code Playgroud) 操作系统:Windows Pro 10
Webstorm:ver 11.0.1
AngularJS:ver 2.0.0-alpha.46
网络风暴设置
工具 – 文件观察者:Babal
语言和框架 – JavaScript:
JavaScript 语言版本:ECMAScript 6
语言和框架 – TypeScript:
启用 TypeScript 编译器(已选中):
使用 tsconfig.json(已选中)
项目结构:
- bin
- node_modules/angular2
- src/tsconfig.json
- package.json
Run Code Online (Sandbox Code Playgroud)
包.json
{
"name": "TypeScriptHTMLApp2",
"version": "1.0.0",
"dependencies": {
"angular2": "2.0.0-alpha.46",
"es6-shim": "^0.33.13",
"systemjs": "0.19.6"
},
"devDependencies": {
"babel-preset-es2015": "^6.3.13"
}
}
Run Code Online (Sandbox Code Playgroud)
配置文件
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
}, …Run Code Online (Sandbox Code Playgroud) 因此,对于NoSQL领域来说是一个全新的人,我决定给mongodb试用,并下载了以下版本,我认为该版本开箱即用:
db version v3.2.4
git version: e2ee9ffcf9f5a94fad76802e28cc978718bb7a30
allocator: tcmalloc
modules: none
build environment:
distarch: x86_64
target_arch: x86_64
Run Code Online (Sandbox Code Playgroud)
所以当我跑步
mongod --sslMode requireSSL --sslPEMKeyFile C:\data\keys\server-key.pem --sslCAFile C:\data\keys\ca-crt.pem
Run Code Online (Sandbox Code Playgroud)
我收到以下错误消息:
解析命令行时出错:无法识别的选项'--sslMode'
尝试“ mongod --help”以获取更多信息
我在这里想念什么?
所以,我遇到了一个问题,一个操作返回上面提到的错误(参见附图),而不是按预期更新redux状态.我在这里俯瞰什么?
actionCreators.js
export function userToken(token) {
console.log('userToken has been fired');
return (dispatch) => {
dispatch({
type: 'Graphcool_Token',
payload: token
});
}
}
Run Code Online (Sandbox Code Playgroud)
App.js
....
// Root Query
const allPostsCommentsQuery = graphql(All_Posts_Comments_Query, {
options: {
cachePolicy: 'offline-critical',
fetchPolicy: 'cache-first',
},
});
export const mapDispatchToProps = (dispatch) => {
return bindActionCreators(actionCreators, dispatch);
}
export default compose(
allPostsCommentsQuery,
connect(mapDispatchToProps)
)(Main);
Run Code Online (Sandbox Code Playgroud)
减速器
var tokenDetails = function(state, action) {
if (state === undefined) {
state = [];
}
switch (action.type) {
case 'Graphcool_Token':
const newState …Run Code Online (Sandbox Code Playgroud) 所以,我试图让“React Developer Tools”chrome 扩展程序知道我的应用程序,但我收到了上述错误。任何人都可以就解决此问题的最佳方法提出建议吗?
import configureMiddleware from './configureMiddleware';
import configureReducer from './configureReducer';
import configureStorage from './configureStorage';
import { applyMiddleware, createStore, compose } from 'redux';
import { persistStore, autoRehydrate } from 'redux-persist';
type Options = {
initialState: Object,
platformDeps?: Object,
platformMiddleware?: Array<Function>,
};
const configureStore = (options: Options) => {
const {
initialState,
platformDeps = {},
platformMiddleware = [],
} = options;
const reducer = configureReducer(initialState);
const middleware = configureMiddleware(
initialState,
platformDeps,
platformMiddleware,
);
const enhancers = compose(
window.devToolsExtension ? window.devToolsExtension() …Run Code Online (Sandbox Code Playgroud)因此,我的firebase结构如下:
"Posts" : {
"0" : {
"code": 12345TG4
"Likes" : 59
},
"1" : {
"code": RT560451
"Likes" : 12
}
}
Run Code Online (Sandbox Code Playgroud)
理想情况下,我想做的是:
var updateData = {
Likes: 74
}
Posts.child(id).update(updateData);
Run Code Online (Sandbox Code Playgroud)
但是我不预先知道UiD,但是我确实有“代码”的值,它本身就是唯一的值。
如何创建查询,该查询可以基于Firebase中“代码”的已知值来更新值“喜欢”?
javascript ×5
reactjs ×4
angular ×1
apollo ×1
duplicates ×1
ecmascript-6 ×1
firebase ×1
mongodb ×1
next.js ×1
redux ×1
redux-thunk ×1
ssl ×1
sw-precache ×1
typescript ×1
webpack ×1
webstorm ×1