Unexpected token You may need an appropriate loader to handle this file type.importing strapi sdk

Unexpected token You may need an appropriate loader to handle this file type.importing strapi sdk



Hi I am trying to import javascript strapi sdk (link) in my new project which is configured using web pack
Here is my code yet



index.ts file


import * as $ from 'jquery';
import Strapi from 'strapi-sdk-javascript'

const strapi = new Strapi('http://localhost:1337')



here is my webpack.config.file


const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');

const webpack = require('webpack');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
module.exports =
entry: './src/index.ts',
module:
rules: [

test: /.js$/,
use:
loader: 'babel-loader',
options:
presets: ['env']

,
// include: [path.resolve(__dirname, "./src/app")],
exclude: /node_modules/

]
,
resolve:
extensions: ['.tsx', '.ts', '.js'],
alias:
$: "jquery/src/jquery",

,

devtool: 'inline-source-map',
devServer:
contentBase: './dist'
,
plugins: [
new CleanWebpackPlugin(['dist']),
new HtmlWebpackPlugin(
template: 'src/assets/template.html'
)
],
output:
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist')

;



and this is giving my this error
error



what am i doing wrong here . please
help thanks in advance




1 Answer
1



You can try something like this


// Process JS with Babel.
mjs)$/,
include: [path.resolve(__dirname,"./src/app")path.resolve('node_modules/strapi-sdk-javascript')],
loader: require.resolve('babel-loader'),
,






not working still :(

– Asad
Sep 6 '18 at 22:07



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)