Sto "migrando" il mio progetto AngularJs da ES6 a TypeScript e sto usando webpack con ts-loader
.Come impedire al webpack di generare file compilati nella directory sorgente
Il problema è che i file compilati e le mappe delle fonti sono scritte nella mia cartella e non come il file bundle.js fornito dalla memoria quando si utilizza webpack-dev-server
.
Invece di avere index.ts
nella mia directory io alla fine con:
.
├── index.js
├── index.js.map
└── index.ts
si può fare?
mio tsconfig.json è:
{
"compilerOptions": {
"target": "es6",
"sourceMap": true,
"module": "commonjs"
},
"exclude": [
"node_modules",
"src/dist"
],
"version": "1.6.2"
}
e webpack.config.js è:
module.exports = {
context: PATHS.app,
entry: {
app: ['./index.ts']
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js'
},
// add resolve clause:root
module: {
loaders: [
{ test: /\.ts$/, exclude: /node_modeuls/, loader: 'babel-loader!ts-loader' },
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' },
{ test: /\.less$/, loader: "style!css!less", exclude: /node_modules/ },
{ test: /\.html$/, loader: "html" },
{ test: /\.(ttf|eot|svg|otf)$/, loader: "file" },
{ test: /\.woff(2)?$/, loader: "url?limit=10000&minetype=application/font-woff" },
{ test: /\.jpe?g$|\.gif$|\.png$|\.svg$|\.woff$|\.ttf$|\.wav$|\.mp3$/, loader: require.resolve("file-loader") + "?name=../[path][name].[ext]"}
]
},
devServer: {
contentBase: "./src"
},
devtool: '#inline-source-map'
}
Sei riuscito a risolvere questo problema? – GPicazo
@GPicazo Non ancora, per ora sto solo aggiungendo questi file al .gitignore. – Shikloshi
Sì, sto facendo lo stesso, ma l'IDE sembra ancora ingombra. – GPicazo