i am trying to use firebase cloud functions in a react project , so i had installed Google cloud SDK , when running npm run the server run without any problems but webpack is keeping showing me this error :
WARNING in ./~/ajv/dist/ajv.bundle.js
Critical dependencies:
1:476-483 This seems to be a pre-built javascript file. Though this is possible, it's not recommended. Try to require the original
source to get better results.
@ ./~/ajv/dist/ajv.bundle.js 1:476-483
ERROR in ./~/translate-api/src/api.js
Module not found: Error: Cannot resolve module 'google-translate-token' in /media/azeddine/ducuments/journey/mini apps/Hire-me/nod
e_modules/translate-api/src
@ ./~/translate-api/src/api.js 6:14-47
ERROR in ./~/cheerio/package.json
Module parse failed: /media/azeddine/ducuments/journey/mini apps/Hire-me/node_modules/cheerio/package.json Unexpected token (2:9)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (2:9)
at Parser.pp$4.raise (/media/azeddine/ducuments/journey/mini apps/Hire-me/node_modules/acorn/dist/acorn.js:2221:15)
at Parser.pp.unexpected (/media/azeddine/ducuments/journey/mini apps/Hire-me/node_modules/acorn/dist/acorn.js:603:10)
at Parser.pp.semicolon (/media/azeddine/ducuments/journey/mini apps/Hire-me/node_modules/acorn/dist/acorn.js:581:61)
at Parser.pp$1.parseExpressionStatement (/media/azeddine/ducuments/journey/mini apps/Hire-me/node_modules/acorn/dist/acorn.js:
966:10)
at Parser.pp$1.parseStatement (/media/azeddine/ducuments/journey/mini apps/Hire-me/node_modules/acorn/dist/acorn.js:730:24)
at Parser.pp$1.parseBlock (/media/azeddine/ducuments/journey/mini apps/Hire-me/node_modules/acorn/dist/acorn.js:981:25)
at Parser.pp$1.parseStatement (/media/azeddine/ducuments/journey/mini apps/Hire-me/node_modules/acorn/dist/acorn.js:709:33)
at Parser.pp$1.parseTopLevel (/media/azeddine/ducuments/journey/mini apps/Hire-me/node_modules/acorn/dist/acorn.js:638:25)
at Parser.parse (/media/azeddine/ducuments/journey/mini apps/Hire-me/node_modules/acorn/dist/acorn.js:516:17)
at Object.parse (/media/azeddine/ducuments/journey/mini apps/Hire-me/node_modules/acorn/dist/acorn.js:3098:39)
@ ./~/cheerio/index.js 11:18-43
const path = require('path');
const webpack = require('webpack');
export default {
entry:[
'webpack-hot-middleware/client',
path.resolve(__dirname,"src")+"/public/script/app.js",
],
output:{
filename:"bundle.js",
path:path.resolve(__dirname,"src")+"/dist",
publicPath: '/',
debug: true,
},
plugins: [
new webpack.NoErrorsPlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin()
],
module:{
loaders:[
{
test:/\.js$/,
loaders:["react-hot","babel"],
// exclude:/(node_module)/,
include:path.resolve(__dirname,"src"),
},
{
test:/\.(css|scss)$/,
loader:"style-loader!css-loader!sass-loader",
},
{
test: /\.(png|woff|woff2|eot|ttf|svg|jpeg|otf)$/,
loader: 'url-loader?limit=100000'
},
],
},
resolve: {
extentions: [ '', '.js' ]
},
node:{
net:"empty",
dns: "empty" ,
}
}
var functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
exports.addMessage = functions.https.onRequest((req, res) => {
// Grab the text parameter.
const original ='hellow world ! from firebase cloud functiondlou';
// Push it into the Realtime Database then send a response
admin.database().ref('/messages').push({original: original}).then(snapshot => {
// Redirect with 303 SEE OTHER to the URL of the pushed object in the Firebase console.
res.redirect(303, snapshot.ref);
});
});
// // Create and Deploy Your First Cloud Functions
// // https://firebase.google.com/docs/functions/write-firebase-functions
//
// exports.helloWorld = functions.https.onRequest((request, response) => {
// response.send("Hello from Firebase!");
// });
via azeddine
No comments:
Post a Comment