Tout fonctionne bien, mais je n'ai pas pu trouver où se trouve mon dossier dist. J'utilise publicPath selon la documentation, le dossier dist semble toujours provenir de la mémoire.
Cela pourrait être un petit problème, je suis nouveau sur webpack. Toute aide fonctionnerait
Voici mon fichier webpack.config.js
var path = require('path')
var webpack = require('webpack')
var HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
entry: "./src/index.js",
output: {
path: path.join(__dirname,'dist'),
filename: "[name].js",
publicPath:'/dist'
},
plugins: [
new HtmlWebpackPlugin({
template: './src/index.html'
})
],
module: {
loaders: [
{
test: /\.css$/, loader: "style-loader!css-loader"
},
{
test: /\.(eot|woff|woff2|ttf|svg|png|jpg)$/,
loader: 'url-loader?limit=30000&name=[name]-[hash].[ext]'
},
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel',
query: {
presets: ['es2015', 'react', 'stage-2']
}
}
]
},
devServer: {
historyApiFallback: true,
stats:'error-only'
}
};
Mon fichier package.json est
{
"name": "tryout",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "mocha './tests/**/*.test.js' --compilers js:babel-core/register --recursive",
"start-dev-server": "webpack-dev-server --content-base dist/ --port 6969",
"s": "npm run start-dev-server",
"test:watch": "npm test -- --watch"
},
"author": "",
"license": "ISC",
"dependencies": {
"babel-core": "^6.13.2",
"babel-loader": "^6.2.4",
"babel-polyfill": "^6.13.0",
"babel-preset-es2015": "^6.13.2",
"babel-preset-react": "^6.11.1",
"babel-preset-stage-2": "^6.13.0",
"es6-promise": "^3.2.1",
"file-loader": "^0.9.0",
"html-webpack-plugin": "^2.22.0",
"isomorphic-fetch": "^2.2.1",
"lodash": "^4.15.0",
"react": "^15.3.0",
"react-dom": "^15.3.0",
"react-redux": "^4.4.5",
"react-router": "^2.6.1",
"react-router-redux": "^4.0.5",
"redux": "^3.5.2",
"redux-thunk": "^2.1.0",
"url-loader": "^0.5.7",
"webpack": "^1.13.1",
"webpack-dev-server": "^1.14.1"
},
"devDependencies": {
"babel-register": "^6.11.6",
"css-loader": "^0.23.1",
"enzyme": "^2.4.1",
"expect": "^1.20.2",
"mocha": "^3.0.2",
"nock": "^8.0.0",
"react-addons-test-utils": "^15.3.1",
"redux-mock-store": "^1.1.4",
"style-loader": "^0.13.1"
}
}
le dossier dist semble toujours provenir de la mémoire
Probablement parce que vous utilisez webpack-dev-server
(c'est ce qu'il fait).
Si vous souhaitez que vos ressources groupées soient réellement écrites sur le disque, exécutez webpack
.