Closed AminAhmadyDeveloper closed 3 years ago
update: changing async funs to promise solved the problem but async also works without prettier loader
could you please format your code, because it's unreadable now
thanks for quick response sir, after I double checked my webpack config file I find out it was my configuration mistake somewhere LOVES <3
If you know how to fix the issue, make a pull request instead.
works fine without prettier loader
here my webpack config:
`const ESLintPlugin = require('eslint-webpack-plugin')
module.exports = { mode: 'development', context: dirname + "/src/js", entry: "./script.js", output: { path: dirname + "/build", filename: "bundle.js" }, module: { rules: [ { test: /.m?js$/, exclude: /node_modules/, use: { loader: "babel-loader", options: { presets: ['@babel/preset-env'] } } }, { test: /.jsx?$/, use: { loader: 'prettier-loader', } } ] }, plugins: [new ESLintPlugin({})] }`
and this is my test js file to be compiled:
async function download(url, ok) { if (ok) { return { name: 'Amin', family: 'Ahmady', website:
http://${url}` } } else { throw new Error('Downloading Failed!') } }async function save(data, ok) { if (ok) { return { user: data, ok: !ok, } } else { throw new Error('Save Failed!') } }
download('github.com', true) .then((data) => save(data, true)) .then((data) => console.log(data)) .catch((err) => console.log(err.message)) `
where is the isseu?
my prettier config if needed:
# Ignore artifacts: build node_modules